svn commit: r274500 - stable/10/usr.sbin/autofs

Edward Tomasz Napierala trasz at FreeBSD.org
Fri Nov 14 10:56:33 UTC 2014


Author: trasz
Date: Fri Nov 14 10:56:33 2014
New Revision: 274500
URL: https://svnweb.freebsd.org/changeset/base/274500

Log:
  MFC r272717:
  
  Remove call to access(2) which didn't serve any purpose, and make it more
  tolerant to errors.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/10/usr.sbin/autofs/common.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/autofs/common.c
==============================================================================
--- stable/10/usr.sbin/autofs/common.c	Fri Nov 14 10:53:55 2014	(r274499)
+++ stable/10/usr.sbin/autofs/common.c	Fri Nov 14 10:56:33 2014	(r274500)
@@ -169,17 +169,12 @@ create_directory(const char *path)
 		if (component == NULL)
 			break;
 		concat(&partial, &component);
-		//log_debugx("checking \"%s\" for existence", partial);
-		error = access(partial, F_OK);
-		if (error == 0)
-			continue;
-		if (errno != ENOENT)
-			log_err(1, "cannot access %s", partial);
-		log_debugx("directory %s does not exist, creating",
-		    partial);
+		//log_debugx("creating \"%s\"", partial);
 		error = mkdir(partial, 0755);
-		if (error != 0)
-			log_err(1, "cannot create %s", partial);
+		if (error != 0 && errno != EEXIST) {
+			log_warn("cannot create %s", partial);
+			return;
+		}
 	}
 
 	free(tofree);


More information about the svn-src-stable-10 mailing list