[PATCH] nscd_conf.c: Fix condition in reload-count

Marek Polacek mpolacek@redhat.com
Fri Jul 15 14:24:00 GMT 2011


In `nscd_parse_file' in the reload-count case we get the `count' and then
we check if it is > than UINT8_MAX -1 and then if it is non-negative,
otherwise we error out.  Nevertheless, since `count' is of type unsigned,
the second condition is always true so we actually never get to the error().
Thusly fixed together with incorrect whitespaces.

2011-07-15  Marek Polacek  <mpolacek@redhat.com>

	* nscd/nscd_conf.c (nscd_parse_file): Fix condition in the
	reload-count case.

--- libc/nscd/nscd_conf.c.mp	2011-07-15 13:36:41.037797537 +0200
+++ libc/nscd/nscd_conf.c	2011-07-15 14:00:07.977673995 +0200
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 2000, 2003-2007, 2008 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2000, 2003-2008, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -239,10 +239,8 @@ nscd_parse_file (const char *fname, stru
 	      unsigned int count = strtoul (arg1, NULL, 0);
 	      if (count > UINT8_MAX - 1)
 		reload_count = UINT_MAX;
-	      else if (count >= 0)
-	    reload_count = count;
 	      else
-		error (0, 0, _("invalid value for 'reload-count': %u"), count);
+		reload_count = count;
 	    }
 	}
       else if (strcmp (entry, "paranoia") == 0)



More information about the Libc-alpha mailing list