mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
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
This commit is contained in:
parent
4c62148d7b
commit
7ebeea9aa6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=272717
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user