diff options
author | trasz <trasz@FreeBSD.org> | 2014-10-07 19:08:02 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2014-10-07 19:08:02 +0000 |
commit | 4c1564fe91c882487190f5fe20ff21f94ed75c00 (patch) | |
tree | f3741ec418b19c9f048060fc599eeb05763fdf76 /usr.sbin | |
parent | 4b224f6ad787399efb9277b01a00ede4921e83ec (diff) | |
download | FreeBSD-src-4c1564fe91c882487190f5fe20ff21f94ed75c00.zip FreeBSD-src-4c1564fe91c882487190f5fe20ff21f94ed75c00.tar.gz |
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
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/autofs/common.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c index cefbcc8..e6db682 100644 --- a/usr.sbin/autofs/common.c +++ b/usr.sbin/autofs/common.c @@ -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); |