Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Nov 2014 10:56:33 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r274500 - stable/10/usr.sbin/autofs
Message-ID:  <201411141056.sAEAuXit067442@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411141056.sAEAuXit067442>