From bc9e0e168b9197effb7893b4ca84584172481a7f Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 7 Aug 1997 02:57:05 +0000 Subject: (ugids_add_user): Ignore errors from idvec_merge_implied_gids. --- libshouldbeinlibc/ugids.c | 44 +++++++++++++++++++++----------------------- 1 file 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); -- cgit v1.2.3