This fixed the following warnings:

/usr/src/usr.bin/rdistd/server.c:845: warning: zero-length printf format string
/usr/src/usr.bin/rdistd/server.c:1150: warning: zero-length printf format string

The error() function already supports passing a NULL format string.
This diff allows message() to handle a NULL format string and changes
the instances of error("") to error(NULL) and message(..., "") to
message(..., NULL).

 - todd

Index: usr.bin/rdist/message.c
===================================================================
RCS file: /cvs/src/usr.bin/rdist/message.c,v
retrieving revision 1.27
diff -u -p -r1.27 message.c
--- usr.bin/rdist/message.c     20 Jan 2015 09:00:16 -0000      1.27
+++ usr.bin/rdist/message.c     30 Mar 2016 20:16:47 -0000
@@ -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);
 }
 
 /*
Index: usr.bin/rdistd/server.c
===================================================================
RCS file: /cvs/src/usr.bin/rdistd/server.c,v
retrieving revision 1.41
diff -u -p -r1.41 server.c
--- usr.bin/rdistd/server.c     30 Mar 2016 17:03:06 -0000      1.41
+++ usr.bin/rdistd/server.c     30 Mar 2016 20:16:47 -0000
@@ -839,7 +839,7 @@ recvfile(char *new, opt_t opts, int mode
                                 * 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
 
        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);

Reply via email to