* src/chage.c: Report failure to unlock the passwd or shadow file

to stderr and syslog.
This commit is contained in:
nekral-guest 2008-08-07 08:02:52 +00:00
parent fd4b6cc52a
commit e3a5f66059
2 changed files with 25 additions and 4 deletions

View File

@ -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

View 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;
}