[quagga-dev 8791] [PATCH 6/9] vty: fix warnings

David Lamparter equinox at diac24.net
Wed Aug 31 16:31:41 BST 2011


From: Stephen Hemminger <shemminger at vyatta.com>

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 at diac24.net>
---
 lib/command.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/command.c b/lib/command.c
index 84d88d5..4c1a339 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, "%s", ((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;
-- 
1.7.6




More information about the Quagga-dev mailing list