[Pkg-shadow-commits] r2070 - in upstream/trunk: . lib

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Mon May 26 09:22:47 UTC 2008


Author: nekral-guest
Date: 2008-05-26 09:22:44 +0000 (Mon, 26 May 2008)
New Revision: 2070

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/sgetpwent.c
Log:
Avoid assignments in comparisons.
Add note about possible bug.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-05-26 09:17:17 UTC (rev 2069)
+++ upstream/trunk/ChangeLog	2008-05-26 09:22:44 UTC (rev 2070)
@@ -6,6 +6,7 @@
 	* lib/sgetpwent.c: Return NULL instead of 0.
 	* lib/sgetpwent.c: Do not check twice if fields[2] and fields[3]
 	are not empty.
+	* lib/sgetpwent.c: Avoid assignments in comparisons.
 
 2008-05-26  Nicolas François  <nicolas.francois at centraliens.net>
 

Modified: upstream/trunk/lib/sgetpwent.c
===================================================================
--- upstream/trunk/lib/sgetpwent.c	2008-05-26 09:17:17 UTC (rev 2069)
+++ upstream/trunk/lib/sgetpwent.c	2008-05-26 09:22:44 UTC (rev 2070)
@@ -108,12 +108,14 @@
 
 	pwent.pw_name = fields[0];
 	pwent.pw_passwd = fields[1];
-	if (
-	    ((pwent.pw_uid = strtol (fields[2], &ep, 10)) == 0 && ('\0' != *ep))) {
+	pwent.pw_uid = strtol (fields[2], &ep, 10);
+	/* FIXME: (0 == pwent.pw_uid) does not look correct -- nekral */
+	if ((0 == pwent.pw_uid) && ('\0' != *ep)) {
 		return NULL;
 	}
-	if (
-	    ((pwent.pw_gid = strtol (fields[3], &ep, 10)) == 0 && ('\0' != *ep))) {
+	/* FIXME: (0 == pwent.pw_gid) does not look correct -- nekral */
+	pwent.pw_gid = strtol (fields[3], &ep, 10);
+	if ((0 == pwent.pw_gid) && ('\0' != *ep))) {
 		return NULL;
 	}
 	pwent.pw_gecos = fields[4];




More information about the Pkg-shadow-commits mailing list