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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Fri Dec 28 10:12:09 UTC 2007


Author: nekral-guest
Date: 2007-12-28 10:12:09 +0000 (Fri, 28 Dec 2007)
New Revision: 1525

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/groupadd.c
Log:
Avoid implict brackets.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2007-12-28 09:39:22 UTC (rev 1524)
+++ upstream/trunk/ChangeLog	2007-12-28 10:12:09 UTC (rev 1525)
@@ -4,6 +4,7 @@
 	* src/groupadd.c (fail_exit): When compiled without AUDIT support, if
 	the return code was E_SUCCESS, fail_exit() wouldn't have exited. Fix
 	the scope of #idef WITH_AUDIT.
+	* src/groupadd.c: Avoid implicit brackets.
 
 2007-12-27  Nicolas François  <nicolas.francois at centraliens.net>
 

Modified: upstream/trunk/src/groupadd.c
===================================================================
--- upstream/trunk/src/groupadd.c	2007-12-28 09:39:22 UTC (rev 1524)
+++ upstream/trunk/src/groupadd.c	2007-12-28 10:12:09 UTC (rev 1525)
@@ -206,8 +206,9 @@
 	 * one already.
 	 */
 
-	if (!gflg)
+	if (!gflg) {
 		group_id = gid_min;
+	}
 
 	/*
 	 * Search the entire group file, either looking for this GID (if the
@@ -224,7 +225,7 @@
 				 Prog, group_name);
 			fail_exit (E_NAME_IN_USE);
 		}
-		if (gflg && group_id == grp->gr_gid) {
+		if (gflg && (group_id == grp->gr_gid)) {
 			if (fflg) {
 				/* turn off -g and search again */
 				gflg = 0;
@@ -235,17 +236,18 @@
 				 Prog, (unsigned int) group_id);
 			fail_exit (E_GID_IN_USE);
 		}
-		if (!gflg && grp->gr_gid >= group_id) {
+		if (!gflg && (grp->gr_gid >= group_id)) {
 			if (grp->gr_gid > gid_max)
 				continue;
 			group_id = grp->gr_gid + 1;
 		}
 	}
-	if (!gflg && group_id == gid_max + 1) {
+	if (!gflg && (group_id == (gid_max + 1))) {
 		for (group_id = gid_min; group_id < gid_max; group_id++) {
 			/* local, no need for xgetgrgid */
-			if (!getgrgid (group_id))
+			if (!getgrgid (group_id)) {
 				break;
+			}
 		}
 		if (group_id == gid_max) {
 			fprintf (stderr, _("%s: can't get unique GID\n"), Prog);
@@ -262,8 +264,9 @@
  */
 static void check_new_name (void)
 {
-	if (check_group_name (group_name))
+	if (check_group_name (group_name)) {
 		return;
+	}
 
 	/*
 	 * All invalid group names land here.
@@ -294,8 +297,9 @@
 			 _("%s: cannot rewrite shadow group file\n"), Prog);
 		fail_exit (E_GRP_UPDATE);
 	}
-	if (is_shadow_grp)
+	if (is_shadow_grp) {
 		sgr_unlock ();
+	}
 #endif				/* SHADOWGRP */
 }
 
@@ -343,13 +347,15 @@
 {
 	(void) gr_unlock ();
 #ifdef	SHADOWGRP
-	if (is_shadow_grp)
+	if (is_shadow_grp) {
 		sgr_unlock ();
+	}
 #endif
 #ifdef WITH_AUDIT
-	if (code != E_SUCCESS)
+	if (code != E_SUCCESS) {
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "adding group",
 			      group_name, -1, 0);
+	}
 #endif
 	exit (code);
 }
@@ -363,7 +369,7 @@
 	char *errptr;
 
 	val = strtol (gidstr, &errptr, 10);
-	if (*errptr || errno == ERANGE || val < 0) {
+	if (('\0' != *errptr) || (errno == ERANGE) || (val < 0)) {
 		fprintf (stderr, _("%s: invalid numeric argument '%s'\n"), Prog,
 			 gidstr);
 		exit (E_BAD_ARG);
@@ -449,8 +455,9 @@
 				}
 				/* terminate name, point to value */
 				*cp++ = '\0';
-				if (putdef_str (optarg, cp) < 0)
+				if (putdef_str (optarg, cp) < 0) {
 					exit (E_BAD_ARG);
+				}
 				break;
 			case 'o':
 				oflg++;
@@ -461,11 +468,13 @@
 		}
 	}
 
-	if (oflg && !gflg)
+	if (oflg && !gflg) {
 		usage ();
+	}
 
-	if (optind != argc - 1)
+	if (optind != argc - 1) {
 		usage ();
+	}
 
 	group_name = argv[argc - 1];
 	check_new_name ();
@@ -531,8 +540,9 @@
 	 */
 	open_files ();
 
-	if (!gflg || !oflg)
+	if (!gflg || !oflg) {
 		find_new_gid ();
+	}
 
 	grp_update ();
 	close_files ();
@@ -540,9 +550,11 @@
 	nscd_flush_cache ("group");
 
 #ifdef USE_PAM
-	if (retval == PAM_SUCCESS)
+	if (retval == PAM_SUCCESS) {
 		pam_end (pamh, PAM_SUCCESS);
+	}
 #endif				/* USE_PAM */
 	exit (E_SUCCESS);
 	/* NOT REACHED */
 }
+




More information about the Pkg-shadow-commits mailing list