summaryrefslogtreecommitdiffstats
path: root/pw/pw_user.c
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
commita46da33ae2cb86b8485b859a9ca1e80b436194c0 (patch)
treeb50ff682ffda962563534b314a0554788ff6384f /pw/pw_user.c
parentd258e65c14f3022902f456d298a237639e30809d (diff)
downloadpw-darwin-a46da33ae2cb86b8485b859a9ca1e80b436194c0.tar.gz
pw-darwin-a46da33ae2cb86b8485b859a9ca1e80b436194c0.tar.zst
pw-darwin-a46da33ae2cb86b8485b859a9ca1e80b436194c0.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>
Diffstat (limited to 'pw/pw_user.c')
-rw-r--r--pw/pw_user.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c
index 149a1ee..f7a6c56 100644
--- a/pw/pw_user.c
+++ b/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);