From f2763b95afc57b88dc9d494b3fbf3841ba38a314 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 7 Sep 2022 18:24:22 +0100 Subject: [PATCH] fix-build: avoid spurious extra vararg and a missing stdlib.h include exim_nullstd() calls string_open_failed("/dev/null", NULL) - a variadic, format-string-checked helper - with a literal path as the format string and an unused NULL vararg, since the literal contains no conversion specifier. Use a proper "%s" format with the path as its argument instead, via a named devnullpath constant shared with the preceding open() call. local_scan.h is missing an explicit #include , relying on it being pulled in transitively by another header. Signed-off-by: Daniel Golle --- src/exim.c | 6 ++++-- src/local_scan.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) --- a/src/exim.c +++ b/src/exim.c @@ -668,13 +668,15 @@ exim_nullstd(void) { int devnull = -1; struct stat statbuf; +const char devnullpath[] = "/dev/null"; + for (int i = 0; i <= 2; i++) { if (fstat(i, &statbuf) < 0 && errno == EBADF) { - if (devnull < 0) devnull = open("/dev/null", O_RDWR); + if (devnull < 0) devnull = open(devnullpath, O_RDWR); if (devnull < 0) log_write_die(LOG_MAIN, "%s", - string_open_failed("/dev/null", NULL)); + string_open_failed("%s", devnullpath)); if (devnull != i) (void)dup2(devnull, i); } } --- a/src/local_scan.h +++ b/src/local_scan.h @@ -30,6 +30,7 @@ settings, and the store functions. */ #include #include +#include #include #pragma GCC visibility push(default) #include "config.h"