Author: bapt Date: Wed Dec 30 23:25:45 2015 New Revision: 292965 URL: https://svnweb.freebsd.org/changeset/base/292965
Log: MFC: r292846, r292847, r292849 Restore dryrun support for pw groupmod Remove useless assignement of linelen Simplify code for parsing extra groups Modified: stable/10/usr.sbin/pw/pw_conf.c stable/10/usr.sbin/pw/pw_group.c stable/10/usr.sbin/pw/pw_vpw.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw_conf.c ============================================================================== --- stable/10/usr.sbin/pw/pw_conf.c Wed Dec 30 23:04:08 2015 (r292964) +++ stable/10/usr.sbin/pw/pw_conf.c Wed Dec 30 23:25:45 2015 (r292965) @@ -313,7 +313,7 @@ read_userconfig(char const * file) ? NULL : newstr(q); break; case _UC_EXTRAGROUPS: - for (i = 0; q != NULL; q = strtok(NULL, toks)) { + while ((q = strtok(NULL, toks)) != NULL) { if (config.groups == NULL) config.groups = sl_init(); sl_add(config.groups, newstr(q)); Modified: stable/10/usr.sbin/pw/pw_group.c ============================================================================== --- stable/10/usr.sbin/pw/pw_group.c Wed Dec 30 23:04:08 2015 (r292964) +++ stable/10/usr.sbin/pw/pw_group.c Wed Dec 30 23:25:45 2015 (r292965) @@ -664,6 +664,11 @@ pw_group_mod(int argc, char **argv, char grp_add_members(&grp, newmembers); } + if (dryrun) { + print_group(grp, pretty); + return (EXIT_SUCCESS); + } + if ((rc = chggrent(name, grp)) != 0) { if (rc == -1) errx(EX_IOERR, "group '%s' not available (NIS?)", Modified: stable/10/usr.sbin/pw/pw_vpw.c ============================================================================== --- stable/10/usr.sbin/pw/pw_vpw.c Wed Dec 30 23:04:08 2015 (r292964) +++ stable/10/usr.sbin/pw/pw_vpw.c Wed Dec 30 23:25:45 2015 (r292965) @@ -70,7 +70,6 @@ vnextpwent(char const *nam, uid_t uid, i pw = NULL; line = NULL; linecap = 0; - linelen = 0; if (pwd_fp != NULL || (pwd_fp = fopen(getpwpath(_MASTERPASSWD), "r")) != NULL) { while ((linelen = getline(&line, &linecap, pwd_fp)) > 0) { @@ -153,7 +152,6 @@ vnextgrent(char const *nam, gid_t gid, i gr = NULL; line = NULL; linecap = 0; - linelen = 0; if (grp_fp != NULL || (grp_fp = fopen(getgrpath(_GROUP), "r")) != NULL) { while ((linelen = getline(&line, &linecap, grp_fp)) > 0) { _______________________________________________ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"