[Pkg-shadow-commits] r1611 - in upstream/trunk: . src

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Tue Jan 1 17:51:54 UTC 2008


Author: nekral-guest
Date: 2008-01-01 17:51:54 +0000 (Tue, 01 Jan 2008)
New Revision: 1611

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/grpck.c
Log:
Avoid implicit conversions to booleans.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-01-01 17:43:18 UTC (rev 1610)
+++ upstream/trunk/ChangeLog	2008-01-01 17:51:54 UTC (rev 1611)
@@ -1,6 +1,7 @@
 2008-01-01  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* src/grpck.c: Avoid implicit brackets.
+	* src/grpck.c: Avoid implicit conversions to booleans.
 
 2008-01-01  Nicolas François  <nicolas.francois at centraliens.net>
 

Modified: upstream/trunk/src/grpck.c
===================================================================
--- upstream/trunk/src/grpck.c	2008-01-01 17:43:18 UTC (rev 1610)
+++ upstream/trunk/src/grpck.c	2008-01-01 17:51:54 UTC (rev 1611)
@@ -329,9 +329,9 @@
 	/*
 	 * Make sure each member exists
 	 */
-	for (i = 0; members[i]; i++) {
+	for (i = 0; NULL != members[i]; i++) {
 		/* local, no need for xgetpwnam */
-		if (getpwnam (members[i])) {
+		if (getpwnam (members[i]) != NULL) {
 			continue;
 		}
 		/*
@@ -372,8 +372,8 @@
 {
 	char **pmem, **other_pmem;
 
-	for (pmem = members; *pmem; pmem++) {
-		for (other_pmem = other_members; *other_pmem; other_pmem++) {
+	for (pmem = members; NULL != *pmem; pmem++) {
+		for (other_pmem = other_members; NULL != *other_pmem; other_pmem++) {
 			if (strcmp (*pmem, *other_pmem) == 0) {
 				break;
 			}
@@ -400,7 +400,7 @@
 	/*
 	 * Loop through the entire group file.
 	 */
-	for (gre = __gr_get_head (); gre; gre = gre->next) {
+	for (gre = __gr_get_head (); NULL != gre; gre = gre->next) {
 		/*
 		 * Skip all NIS entries.
 		 */
@@ -414,7 +414,7 @@
 		 * have no (struct group) entry because they couldn't be
 		 * parsed properly.
 		 */
-		if (!gre->eptr) {
+		if (NULL == gre->eptr) {
 
 			/*
 			 * Tell the user this entire line is bogus and ask
@@ -454,7 +454,7 @@
 		/*
 		 * Make sure this entry has a unique name.
 		 */
-		for (tgre = __gr_get_head (); tgre; tgre = tgre->next) {
+		for (tgre = __gr_get_head (); NULL != tgre; tgre = tgre->next) {
 
 			const struct group *ent = tgre->eptr;
 
@@ -468,7 +468,7 @@
 			/*
 			 * Don't check invalid entries.
 			 */
-			if (!ent) {
+			if (NULL == ent) {
 				continue;
 			}
 
@@ -505,9 +505,10 @@
 		 * groups with no members are returned as groups with one
 		 * member "", causing grpck to fail.  --marekm
 		 */
-		if (grp->gr_mem[0] && !grp->gr_mem[1]
-		    && *(grp->gr_mem[0]) == '\0') {
-			grp->gr_mem[0] = (char *) 0;
+		if (   (NULL != grp->gr_mem[0])
+		    && (NULL == grp->gr_mem[1])
+		    && ('\0' == grp->gr_mem[0][0])) {
+			grp->gr_mem[0] = NULL;
 		}
 
 		if (check_members (grp->gr_name, grp->gr_mem,
@@ -548,7 +549,7 @@
 					         grp->gr_name, sgr_file));
 					*changed = 1;
 
-					if (!sgr_update (&sg)) {
+					if (sgr_update (&sg) == 0) {
 						fprintf (stderr,
 						         _
 						         ("%s: can't update shadow entry for %s\n"),
@@ -558,7 +559,7 @@
 					/* remove password from /etc/group */
 					gr = *grp;
 					gr.gr_passwd = SHADOW_PASSWD_STRING;	/* XXX warning: const */
-					if (!gr_update (&gr)) {
+					if (gr_update (&gr) == 0) {
 						fprintf (stderr,
 						         _
 						         ("%s: can't update entry for group %s\n"),
@@ -594,14 +595,14 @@
 	/*
 	 * Loop through the entire shadow group file.
 	 */
-	for (sge = __sgr_get_head (); sge; sge = sge->next) {
+	for (sge = __sgr_get_head (); NULL != sge; sge = sge->next) {
 
 		/*
 		 * Start with the entries that are completely corrupt. They
 		 * have no (struct sgrp) entry because they couldn't be
 		 * parsed properly.
 		 */
-		if (!sge->eptr) {
+		if (NULL == sge->eptr) {
 
 			/*
 			 * Tell the user this entire line is bogus and ask
@@ -641,7 +642,7 @@
 		/*
 		 * Make sure this entry has a unique name.
 		 */
-		for (tsge = __sgr_get_head (); tsge; tsge = tsge->next) {
+		for (tsge = __sgr_get_head (); NULL != tsge; tsge = tsge->next) {
 
 			const struct sgrp *ent = tsge->eptr;
 
@@ -655,7 +656,7 @@
 			/*
 			 * Don't check invalid entries.
 			 */
-			if (!ent) {
+			if (NULL == ent) {
 				continue;
 			}
 
@@ -779,7 +780,7 @@
 	/*
 	 * Tell the user what we did and exit.
 	 */
-	if (errors) {
+	if (errors != 0) {
 		printf (changed ?
 		        _("%s: the files have been updated\n") :
 		        _("%s: no changes\n"), Prog);




More information about the Pkg-shadow-commits mailing list