summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-12-09 17:28:49 +0000
committerDavid Lamparter <equinox@diac24.net>2010-02-04 22:40:24 +0100
commit75f1999b2c42042725b9ee782e135b0300cc384e (patch)
tree9579f501df6efba60b5107fd32c858bfecf60970
parenta8c48bb76f291c673438d2061753d05a0d9b3276 (diff)
downloadquagga-75f1999b2c42042725b9ee782e135b0300cc384e.tar.bz2
quagga-75f1999b2c42042725b9ee782e135b0300cc384e.tar.xz
vty: fix warnings
Gcc now warns if function that takes printf style formatting is passed a non-constant string. This avoid issues when a format character is entered in some command. Signed-off-by: David Lamparter <equinox@diac24.net>
-rw-r--r--lib/command.c3
-rw-r--r--lib/if.c2
-rw-r--r--lib/vty.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/lib/command.c b/lib/command.c
index ce7a989f..76a45345 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -3021,7 +3021,8 @@ DEFUN (config_logmsg,
if ((level = level_match(argv[0])) == ZLOG_DISABLED)
return CMD_ERR_NO_MATCH;
- zlog(NULL, level, ((message = argv_concat(argv, argc, 1)) ? message : ""));
+ message = argv_concat(argv, argc, 1);
+ zlog(NULL, level, "%s", message ? message : "");
if (message)
XFREE(MTYPE_TMP, message);
return CMD_SUCCESS;
diff --git a/lib/if.c b/lib/if.c
index e3107116..d14cfb93 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -664,7 +664,7 @@ connected_log (struct connected *connected, char *str)
strncat (logbuf, inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ),
BUFSIZ - strlen(logbuf));
}
- zlog (NULL, LOG_INFO, logbuf);
+ zlog (NULL, LOG_INFO, "%s", logbuf);
}
/* If two connected address has same prefix return 1. */
diff --git a/lib/vty.c b/lib/vty.c
index b82add84..58416a5d 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -250,7 +250,7 @@ vty_hello (struct vty *vty)
vty_out (vty, "MOTD file not found%s", VTY_NEWLINE);
}
else if (host.motd)
- vty_out (vty, host.motd);
+ vty_out (vty, "%s", host.motd);
}
/* Put out prompt and wait input from user. */