Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Sep 2021 14:12:22 GMT
From:      Vincenzo Maffione <vmaffione@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5faf08808d63 - stable/13 - libnetmap: reset errno in nmreq_register_decode()
Message-ID:  <202109261412.18QECMgI074983@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/13 has been updated by vmaffione:

URL: https://cgit.FreeBSD.org/src/commit/?id=5faf08808d63ec6724ea7b1bd8a34e2d61095829

commit 5faf08808d63ec6724ea7b1bd8a34e2d61095829
Author:     Vincenzo Maffione <vmaffione@FreeBSD.org>
AuthorDate: 2021-04-02 14:31:57 +0000
Commit:     Vincenzo Maffione <vmaffione@FreeBSD.org>
CommitDate: 2021-09-26 14:11:59 +0000

    libnetmap: reset errno in nmreq_register_decode()
    
    The reset is necessary at the beginning of the function, because of
    the errno logic in the error path (set errno to EINVAL if not set).
    If errno is already set when calling the function, and the function
    fails, the previous errno value will be inherited.
    
    (cherry picked from commit ab639bb2873034786cd2ec4d2d9c4489fbf6f424)
---
 lib/libnetmap/nmreq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libnetmap/nmreq.c b/lib/libnetmap/nmreq.c
index 7f4b2703d22d..31ddea91f6a5 100644
--- a/lib/libnetmap/nmreq.c
+++ b/lib/libnetmap/nmreq.c
@@ -257,6 +257,8 @@ nmreq_register_decode(const char **pifname, struct nmreq_register *r, struct nmc
 	uint16_t nr_ringid;
 	uint64_t nr_flags;
 
+	errno = 0;
+
 	/* fill the request */
 
 	p_state = P_START;


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109261412.18QECMgI074983>