[Pkg-shadow-commits] r3384 - in upstream/trunk: . src

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Thu Jul 14 13:29:05 UTC 2011


Author: nekral-guest
Date: 2011-07-14 13:29:05 +0000 (Thu, 14 Jul 2011)
New Revision: 3384

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/usermod.c
Log:
	* src/usermod.c (move_home): It is always an error to use -m if
	the new home directory already exist (independently from the
	existence of the old home directory did not exist)

Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-07-14 13:28:59 UTC (rev 3383)
+++ upstream/trunk/ChangeLog	2011-07-14 13:29:05 UTC (rev 3384)
@@ -1,6 +1,9 @@
 2011-07-14  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* src/usermod.c: Fix typo in comment.
+	* src/usermod.c (move_home): It is always an error to use -m if
+	the new home directory already exist (independently from the
+	existence of the old home directory did not exist)
 
 2011-07-08  Nicolas François  <nicolas.francois at centraliens.net>
 

Modified: upstream/trunk/src/usermod.c
===================================================================
--- upstream/trunk/src/usermod.c	2011-07-14 13:28:59 UTC (rev 3383)
+++ upstream/trunk/src/usermod.c	2011-07-14 13:29:05 UTC (rev 3384)
@@ -1408,18 +1408,18 @@
 {
 	struct stat sb;
 
-	if (stat (user_home, &sb) == 0) {
+	if (access (user_newhome, F_OK) == 0) {
 		/*
 		 * If the new home directory already exist, the user
 		 * should not use -m.
 		 */
-		if (access (user_newhome, F_OK) == 0) {
-			fprintf (stderr,
-			         _("%s: directory %s exists\n"),
-			         Prog, user_newhome);
-			fail_exit (E_HOMEDIR);
-		}
+		fprintf (stderr,
+		         _("%s: directory %s exists\n"),
+		         Prog, user_newhome);
+		fail_exit (E_HOMEDIR);
+	}
 
+	if (stat (user_home, &sb) == 0) {
 		/*
 		 * Don't try to move it if it is not a directory
 		 * (but /dev/null for example).  --marekm




More information about the Pkg-shadow-commits mailing list