]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/: Transform do-while into while
authorAlejandro Colomar <alx@kernel.org>
Mon, 4 Nov 2024 15:37:48 +0000 (16:37 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 6 Dec 2024 03:20:59 +0000 (21:20 -0600)
list cannot be NULL in the first iteration, so we don't need a do-while.

Just in case it's not obvious: we know it's not NULL in the first
iteration because right above, in line 772, we've already dereferenced
it.

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

index 058b09d929d185b1ae0f026969d8ce2a1a580799..891fd1420501c637fd0bad03fa8d845ff4e99590 100644 (file)
@@ -784,7 +784,7 @@ static int get_groups (char *list)
         * each name and look it up. A mix of numerical and string
         * values for group identifiers is permitted.
         */
-       do {
+       while (NULL != list) {
                char  *g;
 
                /*
@@ -832,7 +832,7 @@ static int get_groups (char *list)
                 */
                user_groups[ngroups++] = xstrdup (grp->gr_name);
                gr_free (grp);
-       } while (NULL != list);
+       }
 
        close_group_files ();
        unlock_group_files ();
index 8cff1d67f8db140283dfca3e74c190ab729c8eb1..f33aec31e336ada25d052f34ecb2cc53226bbb9a 100644 (file)
@@ -236,7 +236,7 @@ static int get_groups (char *list)
         * name and look it up. A mix of numerical and string values for
         * group identifiers is permitted.
         */
-       do {
+       while (NULL != list) {
                char  *g;
 
                /*
@@ -281,7 +281,7 @@ static int get_groups (char *list)
                 */
                user_groups[ngroups++] = xstrdup (grp->gr_name);
                gr_free (grp);
-       } while (NULL != list);
+       }
 
        user_groups[ngroups] = NULL;