]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/gpasswd.c: Move if out of cpp conditional
authorAlejandro Colomar <alx@kernel.org>
Sat, 2 Sep 2023 14:14:03 +0000 (16:14 +0200)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Mon, 4 Dec 2023 10:45:09 +0000 (11:45 +0100)
This simplifies the code a little bit, and prepares for the next
commits, which will clean up further.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/gpasswd.c

index 70002eb1db37b9658bf248c09d0ad453613bcb27..edc2af69ccd4b1aee089c112a4123e2a7fffdafc 100644 (file)
@@ -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
        }
 }