summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2016-03-30 20:52:00 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2016-03-30 20:52:00 +0000
commit46e8eae27625eb3e4fd333cd0362a151ac3ffce6 (patch)
treec3792c6529d43bc63023a0fad9777db4fe4be953
parent3fc6e2bd79421ce9370de0f0d6bbb075a11348a4 (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@
-rw-r--r--usr.bin/rdist/message.c12
-rw-r--r--usr.bin/rdistd/server.c6
2 files changed, 10 insertions, 8 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);
}
/*
diff --git a/usr.bin/rdistd/server.c b/usr.bin/rdistd/server.c
index df86bf06681..45e2254489f 100644
--- a/usr.bin/rdistd/server.c
+++ b/usr.bin/rdistd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.41 2016/03/30 17:03:06 millert Exp $ */
+/* $OpenBSD: server.c,v 1.42 2016/03/30 20:51:59 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -839,7 +839,7 @@ recvfile(char *new, opt_t opts, int mode, char *owner, char *group,
* need to indicate to the master that
* the file was not updated.
*/
- error("");
+ error(NULL);
return;
}
debugmsg(DM_MISC, "Files are different '%s' '%s'.",
@@ -1144,7 +1144,7 @@ recvlink(char *new, opt_t opts, int mode, off_t size)
if (IS_ON(opts, DO_VERIFY) || uptodate) {
if (uptodate)
- message(MT_REMOTE|MT_INFO, "");
+ message(MT_REMOTE|MT_INFO, NULL);
else
message(MT_REMOTE|MT_INFO, "%s: need to update",
target);