Inform the user if out of memory while updating a group database.

This commit is contained in:
nekral-guest 2007-11-16 23:39:42 +00:00
parent 7ecdf9b71f
commit 9afe59af3e
4 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2007-11-17 Nicolas François <nicolas.francois@centraliens.net>
* src/userdel.c, src/usermod.c, src/useradd.c: Inform the user if
out of memory while updating a group database.
2007-11-17 Nicolas François <nicolas.francois@centraliens.net>
* NEWS, src/usermod.c: Update the group database before flushing

View File

@ -727,6 +727,9 @@ static void grp_update (void)
*/
ngrp = __gr_dup (grp);
if (!ngrp) {
fprintf (stderr,
_("%s: Out of memory. Cannot update the group database.\n"),
Prog);
fail_exit (E_GRP_UPDATE); /* XXX */
}
@ -775,6 +778,9 @@ static void grp_update (void)
*/
nsgrp = __sgr_dup (sgrp);
if (!nsgrp) {
fprintf (stderr,
_("%s: Out of memory. Cannot update the shadow group database.\n"),
Prog);
fail_exit (E_GRP_UPDATE); /* XXX */
}

View File

@ -150,6 +150,9 @@ static void update_groups (void)
*/
ngrp = __gr_dup (grp);
if (!ngrp) {
fprintf (stderr,
_("%s: Out of memory. Cannot update the group database.\n"),
Prog);
exit (13); /* XXX */
}
ngrp->gr_mem = del_list (ngrp->gr_mem, user_name);
@ -245,6 +248,9 @@ static void update_groups (void)
nsgrp = __sgr_dup (sgrp);
if (!nsgrp) {
fprintf (stderr,
_("%s: Out of memory. Cannot update the shadow group database.\n"),
Prog);
exit (13); /* XXX */
}

View File

@ -574,7 +574,7 @@ static int update_group (void)
ngrp = __gr_dup (grp);
if (!ngrp) {
fprintf (stderr,
_("%s: out of memory in update_group\n"),
_("%s: Out of memory. Cannot update the group database.\n"),
Prog);
gr_unlock ();
return -1;
@ -696,8 +696,7 @@ static int update_gshadow (void)
nsgrp = __sgr_dup (sgrp);
if (!nsgrp) {
fprintf (stderr,
_
("%s: out of memory in update_gshadow\n"),
_("%s: Out of memory. Cannot update the shadow group database.\n"),
Prog);
sgr_unlock ();
return -1;