diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2017-01-22 18:55:01 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2017-01-22 18:55:01 +0000 |
commit | f856c3ca12b9891190c15f332513b70a0a2044b5 (patch) | |
tree | b856fe1c4e95cf151c06399de91c627c9e70f329 | |
parent | 0643ba5c2cb05e53995be7b42863c9582f7b3624 (diff) | |
download | pw-darwin-f856c3ca12b9891190c15f332513b70a0a2044b5.tar.gz pw-darwin-f856c3ca12b9891190c15f332513b70a0a2044b5.tar.zst pw-darwin-f856c3ca12b9891190c15f332513b70a0a2044b5.zip |
Readd a feature lost in pw(8) refactoring
pw usermod foo -m
It used to be able to (re)create the home directory if it didn't exists
PR: 216224
Reported by: ae
MFC after: 3 days
-rw-r--r-- | pw/pw_user.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c index 75e7fb6..6e991a8 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -1697,6 +1697,10 @@ pw_user_mod(int argc, char **argv, char *arg1) edited = true; } + if (createhome && fstatat(conf.rootfd, pwd->pw_dir, &st, 0) == -1) { + docreatehome = true; + } + if (homedir && strcmp(pwd->pw_dir, homedir) != 0) { pwd->pw_dir = homedir; edited = true; |