Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] cleanup for gcc -Werror=format-security



Recently Mandriva switched to using -Wformat -Werror=format-security as 
default build flags, this made configure and compilation fail with 
"format not a string literal and no format arguments". The patch below 
makes it work again. All tests still passed :)

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.114
diff -u -p -r1.114 configure.ac
--- configure.ac	1 Dec 2008 12:26:25 -0000	1.114
+++ configure.ac	5 Jan 2009 11:04:25 -0000
@@ -1477,27 +1477,27 @@ if test x$zsh_cv_path_term_header != xno
   fi
 
   AC_MSG_CHECKING(if boolcodes is available)
-  AC_TRY_LINK($term_includes, [char **test = boolcodes; 
printf(*test);],
+  AC_TRY_LINK($term_includes, [char **test = boolcodes; puts(*test);],
   AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes, boolcodes=no)
   AC_MSG_RESULT($boolcodes)
   AC_MSG_CHECKING(if numcodes is available)
-  AC_TRY_LINK($term_includes, [char **test = numcodes; printf(*test);],
+  AC_TRY_LINK($term_includes, [char **test = numcodes; puts(*test);],
   AC_DEFINE(HAVE_NUMCODES) numcodes=yes, numcodes=no)
   AC_MSG_RESULT($numcodes)
   AC_MSG_CHECKING(if strcodes is available)
-  AC_TRY_LINK($term_includes, [char **test = strcodes; printf(*test);],
+  AC_TRY_LINK($term_includes, [char **test = strcodes; puts(*test);],
   AC_DEFINE(HAVE_STRCODES) strcodes=yes, strcodes=no)
   AC_MSG_RESULT($strcodes)
   AC_MSG_CHECKING(if boolnames is available)
-  AC_TRY_LINK($term_includes, [char **test = boolnames; 
printf(*test);],
+  AC_TRY_LINK($term_includes, [char **test = boolnames; puts(*test);],
   AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes, boolnames=no)
   AC_MSG_RESULT($boolnames)
   AC_MSG_CHECKING(if numnames is available)
-  AC_TRY_LINK($term_includes, [char **test = numnames; printf(*test);],
+  AC_TRY_LINK($term_includes, [char **test = numnames; puts(*test);],
   AC_DEFINE(HAVE_NUMNAMES) numnames=yes, numnames=no)
   AC_MSG_RESULT($numnames)
   AC_MSG_CHECKING(if strnames is available)
-  AC_TRY_LINK($term_includes, [char **test = strnames; printf(*test);],
+  AC_TRY_LINK($term_includes, [char **test = strnames; puts(*test);],
   AC_DEFINE(HAVE_STRNAMES) strnames=yes, strnames=no)
   AC_MSG_RESULT($strnames)
 else
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.97
diff -u -p -r1.97 zle_tricky.c
--- Src/Zle/zle_tricky.c	12 Oct 2008 18:26:57 -0000	1.97
+++ Src/Zle/zle_tricky.c	5 Jan 2009 11:04:25 -0000
@@ -2286,7 +2286,7 @@ printfmt(char *fmt, int n, int dopr, int
 		case 'n':
 		    sprintf(nc, "%d", n);
 		    if (dopr)
-			fprintf(shout, nc);
+			fputs(nc, shout);
 		    cc += MB_METASTRWIDTH(nc);
 		    break;
 		case 'B':

Attachment: signature.asc
Description: This is a digitally signed message part.



Messages sorted by: Reverse Date, Date, Thread, Author