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

ChangeLog
src/chage.c

index 84bcb145a6e770ec287d002ace59114d209082e3..5ef40352de577c344f9a20e61584cdce0e281745 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-06  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/chage.c: Report failure to unlock the passwd or shadow file
+       to stderr and syslog.
+
 2008-08-06  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/pwconv.c: Report failure to unlock the passwd or shadow file
index 2f7a859b33b9262ea683d70e40d099008810d890..3f9e299eed14def138ca5165e2bd774060cc13b8 100644 (file)
@@ -109,10 +109,18 @@ static void fail_exit (int code);
 static void fail_exit (int code)
 {
        if (spw_locked) {
-               spw_unlock ();
+               if (spw_unlock () == 0) {
+                       fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
+                       SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
+                       /* continue */
+               }
        }
        if (pw_locked) {
-               pw_unlock ();
+               if (pw_unlock () == 0) {
+                       fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
+                       SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
+                       /* continue */
+               }
        }
        closelog ();
 
@@ -616,9 +624,17 @@ static void close_files (void)
                SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
                fail_exit (E_NOPERM);
        }
-       spw_unlock ();
+       if (spw_unlock () == 0) {
+               fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
+               SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
+               /* continue */
+       }
        spw_locked = false;
-       pw_unlock ();
+       if (pw_unlock () == 0) {
+               fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
+               SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
+               /* continue */
+       }
        pw_locked = false;
 }