summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorrobert <robert@FreeBSD.org>2004-06-17 10:29:12 +0000
committerrobert <robert@FreeBSD.org>2004-06-17 10:29:12 +0000
commit2211cbc1f6d4bd24f3100369378258b3a4d54dc9 (patch)
tree704d94e316a1a730d59779aeda67afa44fb69ae2 /usr.sbin
parentf6945e8c81a7f8d92950e055ac90cccaafb4c7cf (diff)
downloadFreeBSD-src-2211cbc1f6d4bd24f3100369378258b3a4d54dc9.zip
FreeBSD-src-2211cbc1f6d4bd24f3100369378258b3a4d54dc9.tar.gz
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>
Diffstat (limited to 'usr.sbin')
-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 149a1ee..f7a6c56 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);
OpenPOWER on IntegriCloud