summaryrefslogtreecommitdiffstats
path: root/usr.sbin/autofs
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-11-14 10:56:33 +0000
committertrasz <trasz@FreeBSD.org>2014-11-14 10:56:33 +0000
commit58ce7ca4f32cfb3b4c15abcff13a18a7f0673731 (patch)
tree32ccc0a8fcb6247e5384cdcf913275ecadeef443 /usr.sbin/autofs
parentfd82234ffe1530f61c8a4235772c9021ec2a898c (diff)
downloadFreeBSD-src-58ce7ca4f32cfb3b4c15abcff13a18a7f0673731.zip
FreeBSD-src-58ce7ca4f32cfb3b4c15abcff13a18a7f0673731.tar.gz
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
Diffstat (limited to 'usr.sbin/autofs')
-rw-r--r--usr.sbin/autofs/common.c15
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);
OpenPOWER on IntegriCloud