]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/gpasswd.c: Simplify cpp conditional
authorAlejandro Colomar <alx@kernel.org>
Sat, 2 Sep 2023 14:19:58 +0000 (16:19 +0200)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Mon, 4 Dec 2023 10:45:09 +0000 (11:45 +0100)
Since failure() is [[noreturn]], we can invert the conditional so that
we don't need an else.  This silences a -Wunused-parameter warning.

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

index bab9bf1935a6eadcd5f89d2c3c5847105b000de2..3936b85e6bbab18a26d9c1bff41e1397444aa408 100644 (file)
@@ -726,15 +726,14 @@ static void check_perms (const struct group *gr)
                 * first group member might be just a normal user.
                 * --marekm
                 */
-#if defined(FIRST_MEMBER_IS_ADMIN)
+#if !defined(FIRST_MEMBER_IS_ADMIN)
+               failure();
+#endif
                if (gr->gr_mem[0] == NULL)
                        failure();
 
                if (strcmp(gr->gr_mem[0], myname) != 0)
                        failure();
-#else                          /* ! FIRST_MEMBER_IS_ADMIN */
-               failure();
-#endif
        }
 }