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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Thu Aug 7 08:02:15 UTC 2008


Author: nekral-guest
Date: 2008-08-07 08:02:13 +0000 (Thu, 07 Aug 2008)
New Revision: 2245

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/grpunconv.c
Log:
	* src/grpunconv.c: Report failure to unlock the group or gshadow
	files to stderr and syslog.

Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-08-07 08:01:44 UTC (rev 2244)
+++ upstream/trunk/ChangeLog	2008-08-07 08:02:13 UTC (rev 2245)
@@ -1,5 +1,10 @@
 2008-08-06  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/grpunconv.c: Report failure to unlock the group or gshadow
+	files to stderr and syslog.
+
+2008-08-06  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/chfn.c: Added fail_exit(). Check if the passwd file is
 	locked. Report failures to unlock to stderr and syslog.
 	* src/chfn.c: Is case of failure, use fail_exit() rather than

Modified: upstream/trunk/src/grpunconv.c
===================================================================
--- upstream/trunk/src/grpunconv.c	2008-08-07 08:01:44 UTC (rev 2244)
+++ upstream/trunk/src/grpunconv.c	2008-08-07 08:02:13 UTC (rev 2245)
@@ -58,16 +58,26 @@
 static bool gshadow_locked = false;
 
 /* local function prototypes */
-static void fail_exit (int);
+static void fail_exit (int status);
 
 static void fail_exit (int status)
 {
 	if (group_locked) {
-		gr_unlock ();
+		if (gr_unlock () == 0) {
+			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
+			SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
+			/* continue */
+		}
 	}
+
 	if (gshadow_locked) {
-		sgr_unlock ();
+		if (sgr_unlock () == 0) {
+			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
+			/* continue */
+		}
 	}
+
 	exit (status);
 }
 
@@ -152,9 +162,22 @@
 		fail_exit (3);
 	}
 
-	sgr_unlock ();
-	gr_unlock ();
+	if (group_locked) {
+		if (gr_unlock () == 0) {
+			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
+			SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
+			/* continue */
+		}
+	}
 
+	if (gshadow_locked) {
+		if (sgr_unlock () == 0) {
+			fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
+			SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
+			/* continue */
+		}
+	}
+
 	nscd_flush_cache ("group");
 
 	return 0;




More information about the Pkg-shadow-commits mailing list