From ccc055d9d94f07e193542fecc5c6ec535f9d3f97 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 2 Sep 2023 16:14:03 +0200 Subject: [PATCH] src/gpasswd.c: Move if out of cpp conditional This simplifies the code a little bit, and prepares for the next commits, which will clean up further. Signed-off-by: Alejandro Colomar --- src/gpasswd.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/gpasswd.c b/src/gpasswd.c index 70002eb1d..edc2af69c 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -710,7 +710,7 @@ static void check_perms (const struct group *gr) } } else #endif /* SHADOWGRP */ - { + if (!amroot) { #ifdef FIRST_MEMBER_IS_ADMIN /* * The policy here for changing a group is that @@ -726,19 +726,13 @@ static void check_perms (const struct group *gr) * first group member might be just a normal user. * --marekm */ - if (!amroot) { - if (gr->gr_mem[0] == NULL) { - failure (); - } + if (gr->gr_mem[0] == NULL) + failure(); - if (strcmp (gr->gr_mem[0], myname) != 0) { - failure (); - } - } + if (strcmp(gr->gr_mem[0], myname) != 0) + failure(); #else /* ! FIRST_MEMBER_IS_ADMIN */ - if (!amroot) { - failure (); - } + failure(); #endif } } -- 2.47.2