diff --git a/ChangeLog b/ChangeLog index 78691912..d4dd47de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-08-06 Nicolas François + + * src/grpunconv.c: Report failure to unlock the group or gshadow + files to stderr and syslog. + 2008-08-06 Nicolas François * src/chfn.c: Added fail_exit(). Check if the passwd file is diff --git a/src/grpunconv.c b/src/grpunconv.c index b29a9ee2..8cc1fdb6 100644 --- a/src/grpunconv.c +++ b/src/grpunconv.c @@ -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");