* src/grpunconv.c: Report failure to unlock the group or gshadow

files to stderr and syslog.
This commit is contained in:
nekral-guest 2008-08-07 08:02:13 +00:00
parent ccc49e8841
commit 93ccc35ff0
2 changed files with 33 additions and 5 deletions

View File

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

View 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");