diff options
Diffstat (limited to 'pw/pw_user.c')
-rw-r--r-- | pw/pw_user.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c index 4b3f550..36c5d9d 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -438,14 +438,13 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) delgrent(GETGRNAM(a_name->val)); SETGRENT(); while ((grp = GETGRENT()) != NULL) { - int i; + int i, j; char group[MAXLOGNAME]; if (grp->gr_mem != NULL) { for (i = 0; grp->gr_mem[i] != NULL; i++) { if (!strcmp(grp->gr_mem[i], a_name->val)) { - while (grp->gr_mem[i] != NULL) { - grp->gr_mem[i] = grp->gr_mem[i+1]; - } + for (j = i; grp->gr_mem[j] != NULL; j++) + grp->gr_mem[j] = grp->gr_mem[j+1]; strlcpy(group, grp->gr_name, MAXLOGNAME); chggrent(group, grp); } |