diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2024-10-24 23:44:43 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-10-30 12:37:31 +0100 |
commit | 744247856da10412a64ce0720f0e7359981748e1 (patch) | |
tree | 7b68a6145a3bb2ce20da66f9d38cca9142858d33 /log.c | |
parent | 98efe7c2fdd82a2822e1be8e5c5c8caed846ae76 (diff) | |
download | passt-744247856da10412a64ce0720f0e7359981748e1.tar passt-744247856da10412a64ce0720f0e7359981748e1.tar.gz passt-744247856da10412a64ce0720f0e7359981748e1.tar.bz2 passt-744247856da10412a64ce0720f0e7359981748e1.tar.lz passt-744247856da10412a64ce0720f0e7359981748e1.tar.xz passt-744247856da10412a64ce0720f0e7359981748e1.tar.zst passt-744247856da10412a64ce0720f0e7359981748e1.zip |
treewide: Silence cert-err33-c clang-tidy warnings for fprintf()
We use fprintf() to print to standard output or standard error
streams. If something gets truncated or there's an output error, we
don't really want to try and report that, and at the same time it's
not abnormal behaviour upon which we should terminate, either.
Just silence the warning with an ugly FPRINTF() variadic macro casting
the fprintf() expressions to void.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -274,7 +274,7 @@ void vlogmsg(bool newline, bool cont, int pri, const char *format, va_list ap) char timestr[LOGTIME_STRLEN]; logtime_fmt(timestr, sizeof(timestr), now); - fprintf(stderr, "%s: ", timestr); + FPRINTF(stderr, "%s: ", timestr); } if ((log_mask & LOG_MASK(LOG_PRI(pri))) || !log_conf_parsed) { @@ -293,7 +293,7 @@ void vlogmsg(bool newline, bool cont, int pri, const char *format, va_list ap) (log_stderr && (log_mask & LOG_MASK(LOG_PRI(pri))))) { (void)vfprintf(stderr, format, ap); if (newline && format[strlen(format)] != '\n') - fprintf(stderr, "\n"); + FPRINTF(stderr, "\n"); } } @@ -399,7 +399,7 @@ void passt_vsyslog(bool newline, int pri, const char *format, va_list ap) n += snprintf(buf + n, BUFSIZ - n, "\n"); if (log_sock >= 0 && send(log_sock, buf, n, 0) != n && log_stderr) - fprintf(stderr, "Failed to send %i bytes to syslog\n", n); + FPRINTF(stderr, "Failed to send %i bytes to syslog\n", n); } /** |