svn commit: r272717 - head/usr.sbin/autofs

Edward Tomasz Napierala trasz at FreeBSD.org
Tue Oct 7 19:08:03 UTC 2014


Author: trasz
Date: Tue Oct  7 19:08:02 2014
New Revision: 272717
URL: https://svnweb.freebsd.org/changeset/base/272717

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

Modified:
  head/usr.sbin/autofs/common.c

Modified: head/usr.sbin/autofs/common.c
==============================================================================
--- head/usr.sbin/autofs/common.c	Tue Oct  7 19:07:50 2014	(r272716)
+++ head/usr.sbin/autofs/common.c	Tue Oct  7 19:08:02 2014	(r272717)
@@ -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-all mailing list