aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pw
diff options
context:
space:
mode:
authorRobert Drehmel <robert@FreeBSD.org>2004-06-17 10:29:12 +0000
committerRobert Drehmel <robert@FreeBSD.org>2004-06-17 10:29:12 +0000
commit10403170765808b4333268759191d856effb2262 (patch)
tree704d94e316a1a730d59779aeda67afa44fb69ae2 /usr.sbin/pw
parent2c67a07fd01bfbbe94c8eeacbbcd8a7bde55673b (diff)
downloadsrc-10403170765808b4333268759191d856effb2262.tar.gz
src-10403170765808b4333268759191d856effb2262.zip
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>
Notes
Notes: svn path=/head/; revision=130629
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r--usr.sbin/pw/pw_user.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c
index 149a1eebf738..f7a6c5689618 100644
--- a/usr.sbin/pw/pw_user.c
+++ b/usr.sbin/pw/pw_user.c
@@ -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);