1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-16 04:15:34 +02:00

treewide: Argument cannot be negative, CWE-687

Actually harmless. Reported by Coverity.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2022-04-05 11:51:47 +02:00
parent bb76470090
commit eb3d3f367e
4 changed files with 30 additions and 22 deletions

12
util.h
View file

@ -58,6 +58,18 @@ void trace_init(int enable);
#define TMPDIR "/tmp"
#endif
#define FWRITE(path, buf, str) \
do { \
int flags = O_WRONLY | O_CLOEXEC; \
int fd = open(path, flags); \
\
if (fd < 0 || \
write(fd, buf, strlen(buf)) != (int)strlen(buf)) \
warn(str); \
if (fd >= 0) \
close(fd); \
} while (0)
#define V4 0
#define V6 1
#define IP_VERSIONS 2