diff options
author | Miles Bader <miles@gnu.org> | 1997-08-07 02:57:05 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-08-07 02:57:05 +0000 |
commit | bc9e0e168b9197effb7893b4ca84584172481a7f (patch) | |
tree | 62a02fa01705bfd33d3d6347cf909ac1b16360ca | |
parent | eedb6dfb718e2dd75da4447249ce45f6a11ff1bf (diff) |
(ugids_add_user):
Ignore errors from idvec_merge_implied_gids.
-rw-r--r-- | libshouldbeinlibc/ugids.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/libshouldbeinlibc/ugids.c b/libshouldbeinlibc/ugids.c index 5ccb9334..057dcf81 100644 --- a/libshouldbeinlibc/ugids.c +++ b/libshouldbeinlibc/ugids.c @@ -67,31 +67,29 @@ ugids_add_user (struct ugids *ugids, uid_t uid, int avail) struct idvec uids = { uids_ids, 1 }; struct idvec *gids = avail ? &ugids->avail_gids : &ugids->eff_gids; - err = idvec_merge_implied_gids (&imp_gids, &uids); + idvec_merge_implied_gids (&imp_gids, &uids); + + /* Now remove any gids we already know about from IMP_GIDS. For gids + that weren't in the appropiate implied set before, this will + ensure that they remain out after we merge IMP_GIDS into it, and + ones that *were*, they will remain so. */ + idvec_subtract (&imp_gids, gids); + + /* Try to add UID. */ + err = idvec_add_new (avail ? &ugids->avail_uids : &ugids->eff_uids, uid); + + if (! err) + /* Now that we've added UID, we can add appropriate implied gids. + [If this fails, UGIDS will be an inconsistent state, but things + are probably fucked anyhow] */ + err = + idvec_merge (avail ? &ugids->avail_gids : &ugids->eff_gids, + &imp_gids); if (! err) - { - /* Now remove any gids we already know about from IMP_GIDS. For gids - that weren't in the appropiate implied set before, this will - ensure that they remain out after we merge IMP_GIDS into it, and - ones that *were*, they will remain so. */ - idvec_subtract (&imp_gids, gids); - - /* Try to add UID. */ - err = idvec_add_new (avail ? &ugids->avail_uids : &ugids->eff_uids, uid); - - if (! err) - /* Now that we've added UID, we can add appropriate implied gids. - [If this fails, UGIDS will be an inconsistent state, but things - are probably fucked anyhow] */ - err = - idvec_merge (avail ? &ugids->avail_gids : &ugids->eff_gids, + err = idvec_merge ((avail + ? &ugids->imp_avail_gids + : &ugids->imp_eff_gids), &imp_gids); - if (! err) - err = idvec_merge ((avail - ? &ugids->imp_avail_gids - : &ugids->imp_eff_gids), - &imp_gids); - } idvec_fini (&imp_gids); |