findutils-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Findutils-patches] [patch] avoid compiler warnings


From: Eric Blake
Subject: [Findutils-patches] [patch] avoid compiler warnings
Date: Thu, 14 Feb 2008 16:06:23 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

One of these is merely a warning; but the other is a true bug, since POSIX 
states that mixing %1$d and %d in the same printf format gives undefined 
behavior.  OK to apply?

2008-02-14  Eric Blake  <address@hidden>

        Avoid compiler warnings.
        * find/pred.c (pred_name_common): Remove unused variable.
        * locate/locate.c (print_stats): Avoid undefined format string.

Index: find/pred.c
===================================================================
RCS file: /sources/findutils/findutils/find/pred.c,v
retrieving revision 1.111
diff -u -p -b -r1.111 pred.c
--- find/pred.c 12 Feb 2008 12:17:48 -0000      1.111
+++ find/pred.c 14 Feb 2008 16:01:44 -0000
@@ -1185,7 +1185,6 @@ pred_ilname (const char *pathname, struc
 static boolean
 pred_name_common (const char *pathname, const char *str, int flags)
 {
-  char *p;
   boolean b;
   /* We used to use last_component() here, but that would not allow us to 
modify the 
    * input string, which is const.   We could optimise by duplicating the 
string only
Index: locate/locate.c
===================================================================
RCS file: /sources/findutils/findutils/locate/locate.c,v
retrieving revision 1.94
diff -u -p -b -r1.94 locate.c
--- locate/locate.c     9 Feb 2008 10:44:24 -0000       1.94
+++ locate/locate.c     14 Feb 2008 16:01:44 -0000
@@ -1,6 +1,6 @@
 /* locate -- search databases for filenames that match patterns
    Copyright (C) 1994, 1996, 1998, 1999, 2000, 2003,
-                 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+                 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -909,7 +909,7 @@ print_stats(int argc, size_t database_fi
   /* XXX: We would ideally use ngettext() here, but I don't know 
    *      how to use it to handle more than one possibly-plural thing/
    */
-  printf(_("File names have a cumulative length of %1$s bytes.\n"
+  printf(_("File names have a cumulative length of %s bytes.\n"
           "Of those file names,\n"
           "\n\t%s contain whitespace, "
           "\n\t%s contain newline characters, "






reply via email to

[Prev in Thread] Current Thread [Next in Thread]