aboutsummaryrefslogtreecommitdiff
path: root/lib/libnetmap
diff options
context:
space:
mode:
authorVincenzo Maffione <vmaffione@FreeBSD.org>2021-04-02 14:31:57 +0000
committerVincenzo Maffione <vmaffione@FreeBSD.org>2021-04-02 14:31:57 +0000
commitab639bb2873034786cd2ec4d2d9c4489fbf6f424 (patch)
treee66066c074266ee2aad577f94361dc3f3314c063 /lib/libnetmap
parent69efe3695d75d716e6066a0b1225df00ec98952b (diff)
downloadsrc-ab639bb2873034786cd2ec4d2d9c4489fbf6f424.tar.gz
src-ab639bb2873034786cd2ec4d2d9c4489fbf6f424.zip
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.
Diffstat (limited to 'lib/libnetmap')
-rw-r--r--lib/libnetmap/nmreq.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libnetmap/nmreq.c b/lib/libnetmap/nmreq.c
index 390f791cb4dd..2c35b3a30089 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;