diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2016-03-30 20:52:00 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2016-03-30 20:52:00 +0000 |
commit | 46e8eae27625eb3e4fd333cd0362a151ac3ffce6 (patch) | |
tree | c3792c6529d43bc63023a0fad9777db4fe4be953 /usr.bin/rdist | |
parent | 3fc6e2bd79421ce9370de0f0d6bbb075a11348a4 (diff) |
Avoid compiler warning about zero-length printf format strings.
Allow a NULL format in message() and switch the two calls to
error() and message() with an empty format string to using NULL.
OK deraadt@
Diffstat (limited to 'usr.bin/rdist')
-rw-r--r-- | usr.bin/rdist/message.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/rdist/message.c b/usr.bin/rdist/message.c index bc397918c58..05f1413ddb3 100644 --- a/usr.bin/rdist/message.c +++ b/usr.bin/rdist/message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: message.c,v 1.27 2015/01/20 09:00:16 guenther Exp $ */ +/* $OpenBSD: message.c,v 1.28 2016/03/30 20:51:59 millert Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -591,11 +591,13 @@ message(int lvl, const char *fmt, ...) static char buf[MSGBUFSIZ]; va_list args; - va_start(args, fmt); - (void) vsnprintf(buf, sizeof(buf), fmt, args); - va_end(args); + if (fmt != NULL) { + va_start(args, fmt); + (void) vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + } - _message(lvl, buf); + _message(lvl, fmt ? buf : NULL); } /* |