summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2016-03-30 20:51:59 +0000
committermillert <millert@openbsd.org>2016-03-30 20:51:59 +0000
commitd1aa792a0d0351e56dfc1fa6d8e11e7a09e55ecf (patch)
tree44a97d37f4244ab3aa6b5a4c2e78f27efc56f0b9
parentIn setnonblocking() rename "mode" variable to "flags". (diff)
downloadwireguard-openbsd-d1aa792a0d0351e56dfc1fa6d8e11e7a09e55ecf.tar.xz
wireguard-openbsd-d1aa792a0d0351e56dfc1fa6d8e11e7a09e55ecf.zip
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);