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:
Baptiste Daroussin 2017-01-22 18:55:01 +00:00
parent db569544d1
commit 6789e5acf2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=312644

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;