]> git.cameronkatri.com Git - pw-darwin.git/commitdiff
Readd a feature lost in pw(8) refactoring
authorBaptiste Daroussin <bapt@FreeBSD.org>
Sun, 22 Jan 2017 18:55:01 +0000 (18:55 +0000)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Sun, 22 Jan 2017 18:55:01 +0000 (18:55 +0000)
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

pw/pw_user.c

index 75e7fb6e5c8887127e372b50280ec64193c072ea..6e991a858d8f3d18c7fe95ec77cf0522358184b8 100644 (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;