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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Thu Dec 27 21:43:29 UTC 2007


Author: nekral-guest
Date: 2007-12-27 21:43:29 +0000 (Thu, 27 Dec 2007)
New Revision: 1512

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/gpasswd.c
Log:
Avoid assignment in comparisons.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2007-12-27 21:30:12 UTC (rev 1511)
+++ upstream/trunk/ChangeLog	2007-12-27 21:43:29 UTC (rev 1512)
@@ -12,6 +12,7 @@
 	* src/gpasswd.c: New functions: check_perms(), get_group(),
 	change_passwd(), check_flags(). Split out of main() to simplify main().
 	* src/gpasswd.c: Avoid implicit brackets.
+	* src/gpasswd.c: Avoid assignment in comparisons.
 
 2007-12-27  Nicolas François  <nicolas.francois at centraliens.net>
 

Modified: upstream/trunk/src/gpasswd.c
===================================================================
--- upstream/trunk/src/gpasswd.c	2007-12-27 21:30:12 UTC (rev 1511)
+++ upstream/trunk/src/gpasswd.c	2007-12-27 21:43:29 UTC (rev 1512)
@@ -161,7 +161,8 @@
 	size_t len;
 
 	for (start = users; start && *start; start = end) {
-		if ((end = strchr (start, ','))) {
+		end = strchr (start, ',');
+		if (NULL != end) {
 			len = end - start;
 			end++;
 		} else {
@@ -315,7 +316,7 @@
 #endif
 		exit (1);
 	}
-#ifdef  SHADOWGRP
+#ifdef SHADOWGRP
 	if (is_shadowgrp && (sgr_lock () == 0)) {
 		fprintf (stderr, _("%s: can't get shadow lock\n"), Prog);
 		SYSLOG ((LOG_WARN, "failed to get lock for /etc/gshadow"));
@@ -335,7 +336,7 @@
 #endif
 		exit (1);
 	}
-#ifdef  SHADOWGRP
+#ifdef SHADOWGRP
 	if (is_shadowgrp && (sgr_open (O_RDWR) == 0)) {
 		fprintf (stderr, _("%s: can't open shadow file\n"), Prog);
 		SYSLOG ((LOG_WARN, "cannot open /etc/gshadow"));
@@ -366,7 +367,7 @@
 #endif
 		exit (1);
 	}
-#ifdef  SHADOWGRP
+#ifdef SHADOWGRP
 	if (is_shadowgrp && (sgr_close () == 0)) {
 		fprintf (stderr, _("%s: can't re-write shadow file\n"), Prog);
 		SYSLOG ((LOG_WARN, "cannot re-write /etc/gshadow"));
@@ -517,7 +518,8 @@
 		exit (1);
 	}
 
-	if (!(tmpgr = gr_locate (group))) {
+	tmpgr = gr_locate (group);
+	if (NULL == tmpgr) {
 		fprintf (stderr, _("unknown group: %s\n"), group);
 #ifdef WITH_AUDIT
 		audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
@@ -551,7 +553,8 @@
 #endif
 		exit (1);
 	}
-	if ((tmpsg = sgr_locate (group))) {
+	tmpsg = sgr_locate (group);
+	if (NULL != tmpsg) {
 		*sg = *tmpsg;
 		sg->sg_name = xstrdup (tmpsg->sg_name);
 		sg->sg_passwd = xstrdup (tmpsg->sg_passwd);
@@ -616,13 +619,15 @@
 	printf (_("Changing the password for group %s\n"), group);
 
 	for (retries = 0; retries < RETRIES; retries++) {
-		if (!(cp = getpass (_("New Password: ")))) {
+		cp = getpass (_("New Password: "));
+		if (NULL == cp) {
 			exit (1);
 		}
 
 		STRFCPY (pass, cp);
 		strzero (cp);
-		if (!(cp = getpass (_("Re-enter new password: ")))) {
+		cp = getpass (_("Re-enter new password: "));
+		if (NULL == cp) {
 			exit (1);
 		}
 




More information about the Pkg-shadow-commits mailing list