From 36f0199f6ef4183837ae72551a778a4054de43fd Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 16 Feb 2023 19:19:23 +0100 Subject: 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 --- tap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tap.c') diff --git a/tap.c b/tap.c index 88eed88..d6f962e 100644 --- a/tap.c +++ b/tap.c @@ -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)) { -- cgit v1.2.3