]> granicus.if.org Git - procps-ng/commitdiff
Fix string literals in fprintf and friends
authorCraig Small <csmall@enc.com.au>
Sat, 3 Mar 2012 01:05:07 +0000 (12:05 +1100)
committerCraig Small <csmall@enc.com.au>
Sat, 3 Mar 2012 01:05:07 +0000 (12:05 +1100)
Both these are from [-Werror=format-security]
sig.c:262:5: error: format not a string literal and no format arguments
global.c:517:3: error: format not a string literal and no format arguments

proc/sig.c
ps/global.c

index b427e01e8435a47c0081415f388970a4e63e5224..7d23edc4434c104fa151e0078fe7275d285d4dc8 100644 (file)
@@ -259,7 +259,7 @@ void pretty_print_signals(void){
   while(++i <= number_of_signals){
     int n;
     n = printf("%2d %s", i, signal_number_to_name(i));
-    if(n>0 && i%7) printf("           \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + n);
+    if(n>0 && i%7) printf("%s", "           \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + n);
     else printf("\n");
   }
   if((i-1)%7) printf("\n");
index 11f058e5b6907dabb53ab29ca1c252d44ba54930..0898a5eaa972144aa5d1dcba87fa9b1af2dcd7ab 100644 (file)
@@ -514,6 +514,6 @@ catastrophic_failure(const char *filename,
                     unsigned int linenum,
                     const char *message)
 {
-  error_at_line(0, 0, filename, linenum, message);
+  error_at_line(0, 0, filename, linenum, "%s", message);
   exit(EXIT_FAILURE);
 }