log, conf, tap: Define die() as err() plus exit(), drop cppcheck workarounds

If we define die() as a variadic macro, passing __VA_ARGS__ to err(),
and calling exit() outside err() itself, we can drop the workarounds
introduced in commit 36f0199f6e ("conf, tap: Silence two false
positive invalidFunctionArg from cppcheck").

Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Stefano Brivio
2023-02-27 04:06:19 +01:00
parent fb05a71378
commit d2df763232
4 changed files with 12 additions and 18 deletions

3
conf.c
View File

@@ -1064,9 +1064,6 @@ static void conf_ugid(char *runas, uid_t *uid, gid_t *gid)
if ((fd = open("/proc/self/uid_map", O_RDONLY | O_CLOEXEC)) < 0) {
die("Can't determine if we're in init namespace: %s",
strerror(errno));
/* Silence cppcheck's invalidFunctionArg for 'fd' in read() */
return;
}
if (read(fd, buf, BUFSIZ) != sizeof(root_uid_map) ||