]> granicus.if.org Git - shadow/commitdiff
* src/grpunconv.c: Report failure to unlock the group or gshadow
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 7 Aug 2008 08:02:13 +0000 (08:02 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 7 Aug 2008 08:02:13 +0000 (08:02 +0000)
files to stderr and syslog.

ChangeLog
src/grpunconv.c

index 78691912e4f1b38c07b92f6ef8ccd4df81a3c83e..d4dd47de1f3a0921a1f2633ac8c3abe0fe8e7fb6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-06  Nicolas François  <nicolas.francois@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@centraliens.net>
 
        * src/chfn.c: Added fail_exit(). Check if the passwd file is
index b29a9ee2a0e2c28a1faf2c7a602b8b6aa2232954..8cc1fdb6e42991394b60074f622c61bdcba26469 100644 (file)
@@ -58,16 +58,26 @@ static bool group_locked   = false;
 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,8 +162,21 @@ int main (int argc, char **argv)
                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");