aboutgitcodebugslistschat
path: root/util.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-20 00:05:11 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-20 08:34:22 +0200
commit12cfa6444cd239dbc04391027ad3161f53b6901c (patch)
tree3fa746cef0cf3f543ebbe2e0d1535a331a1f2bd0 /util.c
parent7f1e7019cbd47a13dde38782d4bc7430cecff8c4 (diff)
downloadpasst-12cfa6444cd239dbc04391027ad3161f53b6901c.tar
passt-12cfa6444cd239dbc04391027ad3161f53b6901c.tar.gz
passt-12cfa6444cd239dbc04391027ad3161f53b6901c.tar.bz2
passt-12cfa6444cd239dbc04391027ad3161f53b6901c.tar.lz
passt-12cfa6444cd239dbc04391027ad3161f53b6901c.tar.xz
passt-12cfa6444cd239dbc04391027ad3161f53b6901c.tar.zst
passt-12cfa6444cd239dbc04391027ad3161f53b6901c.zip
passt: Add clang-tidy Makefile target and test, take care of warnings
Most are just about style and form, but a few were actually serious mistakes (NDP-related). Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.c')
-rw-r--r--util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/util.c b/util.c
index 56b256d..4c2e9bb 100644
--- a/util.c
+++ b/util.c
@@ -143,7 +143,7 @@ void passt_vsyslog(int pri, const char *format, va_list ap)
n += snprintf(buf + n, BUFSIZ - n, "\n");
if (log_opt | LOG_PERROR)
- fprintf(stderr, buf + sizeof("<0>"));
+ fprintf(stderr, "%s", buf + sizeof("<0>"));
send(log_sock, buf, n, 0);
}
@@ -362,7 +362,7 @@ void bitmap_clear(uint8_t *map, int bit)
*
* Return: non-zero if given bit is set, zero if it's not
*/
-int bitmap_isset(uint8_t *map, int bit)
+int bitmap_isset(const uint8_t *map, int bit)
{
return map[bit / 8] & (1 << bit % 8);
}
@@ -437,6 +437,7 @@ void procfs_scan_listen(char *name, uint8_t *map, uint8_t *exclude)
*line = 0;
line_read(line, sizeof(line), fd);
while (line_read(line, sizeof(line), fd)) {
+ /* NOLINTNEXTLINE(cert-err34-c): != 2 if conversion fails */
if (sscanf(line, "%*u: %*x:%lx %*x:%*x %x", &port, &state) != 2)
continue;