* src/groupmems.c: Call open_files() and close_files().

* src/groupmems.c: Always call check_perms(), which takes care of
	checking if --list is used.
This commit is contained in:
nekral-guest 2008-09-06 16:27:21 +00:00
parent a7b3bcb43c
commit 70cf08329b
2 changed files with 9 additions and 21 deletions

View File

@ -1,3 +1,9 @@
2008-09-06 Nicolas François <nicolas.francois@centraliens.net>
* src/groupmems.c: Call open_files() and close_files().
* src/groupmems.c: Always call check_perms(), which takes care of
checking if --list is used.
2008-09-06 Nicolas François <nicolas.francois@centraliens.net> 2008-09-06 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/obscure.c: Compare characters to '\0', not NULL. * libmisc/obscure.c: Compare characters to '\0', not NULL.

View File

@ -607,20 +607,11 @@ int main (int argc, char **argv)
} }
} }
if (!list) { check_perms ();
check_perms ();
if (gr_lock () == 0) { open_files ();
fprintf (stderr,
_("%s: cannot lock %s; try again later.\n"),
Prog, gr_dbname ());
fail_exit (EXIT_GROUP_FILE);
}
gr_locked = true;
}
grp = gr_locate (name); grp = gr_locate (name);
if (NULL == grp) { if (NULL == grp) {
fprintf (stderr, _("%s: group '%s' does not exist in %s\n"), fprintf (stderr, _("%s: group '%s' does not exist in %s\n"),
Prog, name, gr_dbname ()); Prog, name, gr_dbname ());
@ -637,16 +628,7 @@ int main (int argc, char **argv)
purge_members (grp); purge_members (grp);
} }
if (gr_close () == 0) { close_files ();
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ());
SYSLOG ((LOG_ERR, "failure while writing %s", gr_dbname ()));
fail_exit (EXIT_GROUP_FILE);
}
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 */
}
exit (EXIT_SUCCESS); exit (EXIT_SUCCESS);
} }