svn commit: r312644 - head/usr.sbin/pw

Baptiste Daroussin bapt at FreeBSD.org
Sun Jan 22 18:55:02 UTC 2017


Author: bapt
Date: Sun Jan 22 18:55:01 2017
New Revision: 312644
URL: https://svnweb.freebsd.org/changeset/base/312644

Log:
  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

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==============================================================================
--- head/usr.sbin/pw/pw_user.c	Sun Jan 22 18:31:49 2017	(r312643)
+++ head/usr.sbin/pw/pw_user.c	Sun Jan 22 18:55:01 2017	(r312644)
@@ -1697,6 +1697,10 @@ pw_user_mod(int argc, char **argv, char 
 		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;


More information about the svn-src-head mailing list