summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2017-01-22 18:55:01 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2017-01-22 18:55:01 +0000
commitf856c3ca12b9891190c15f332513b70a0a2044b5 (patch)
treeb856fe1c4e95cf151c06399de91c627c9e70f329
parent0643ba5c2cb05e53995be7b42863c9582f7b3624 (diff)
downloadpw-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.c4
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;