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 | 99c2ffdd3d9859176bc87b408b9f6eee7995f68f (patch) | |
tree | 07b779c7108e17d1762a8e071d7438ed450a570a /pw | |
parent | 714016a9d9e28dd9956794c3916bb3f2c6f68cbc (diff) | |
download | pw-darwin-99c2ffdd3d9859176bc87b408b9f6eee7995f68f.tar.gz pw-darwin-99c2ffdd3d9859176bc87b408b9f6eee7995f68f.tar.zst pw-darwin-99c2ffdd3d9859176bc87b408b9f6eee7995f68f.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
Diffstat (limited to 'pw')
-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; |