diff --git a/src/useradd.c b/src/useradd.c index 058b09d9..891fd142 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -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 (); diff --git a/src/usermod.c b/src/usermod.c index 8cff1d67..f33aec31 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -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;