diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2023-02-16 19:19:23 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-02-16 19:19:23 +0100 |
commit | 36f0199f6ef4183837ae72551a778a4054de43fd (patch) | |
tree | 1e0bbf87b6daaf1b10e256c356871b015b8d8795 /tap.c | |
parent | 89e0fbfaa777ef28b5269421cc6770589145d4e6 (diff) | |
download | passt-36f0199f6ef4183837ae72551a778a4054de43fd.tar passt-36f0199f6ef4183837ae72551a778a4054de43fd.tar.gz passt-36f0199f6ef4183837ae72551a778a4054de43fd.tar.bz2 passt-36f0199f6ef4183837ae72551a778a4054de43fd.tar.lz passt-36f0199f6ef4183837ae72551a778a4054de43fd.tar.xz passt-36f0199f6ef4183837ae72551a778a4054de43fd.tar.zst passt-36f0199f6ef4183837ae72551a778a4054de43fd.zip |
conf, tap: Silence two false positive invalidFunctionArg from cppcheck
The newly introduced die() calls exit(), but cppcheck doesn't see it
and warns about possibly invalid arguments used after the check which
triggers die(). Add return statements to silence the warnings.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tap.c')
-rw-r--r-- | tap.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1037,9 +1037,13 @@ static void tap_sock_unix_init(struct ctx *c) snprintf(path, UNIX_PATH_MAX - 1, UNIX_SOCK_PATH, i); ex = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0); - if (ex < 0) + if (ex < 0) { die("UNIX domain socket check: %s", strerror(errno)); + /* Silence cppcheck's invalidFunctionArg for 'ex' */ + return; + } + ret = connect(ex, (const struct sockaddr *)&addr, sizeof(addr)); if (!ret || (errno != ENOENT && errno != ECONNREFUSED && errno != EACCES)) { |