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
This commit is contained in:
bapt 2017-01-22 18:55:01 +00:00
parent 6cbb1654e8
commit 42f5c8a914

View File

@ -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;