Fix a bug which occurred when the home directory given by the

-d option was equal to the one already saved and which caused
the pw utility to avoid updating values passed by other options
processed before the -d option in the code path.

Spotted by: Richard Caley <rjc@interactive.co.uk>
This commit is contained in:
Robert Drehmel 2004-06-17 10:29:12 +00:00
parent 2c67a07fd0
commit 1040317076

View File

@ -537,7 +537,8 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
}
if ((arg = getarg(args, 'd')) != NULL) {
edited = strcmp(pwd->pw_dir, arg->val) != 0;
if (strcmp(pwd->pw_dir, arg->val))
edited = 1;
if (stat(pwd->pw_dir = arg->val, &st) == -1) {
if (getarg(args, 'm') == NULL && strcmp(pwd->pw_dir, "/nonexistent") != 0)
warnx("WARNING: home `%s' does not exist", pwd->pw_dir);