Commit 84bdfb2b by Serge Hallyn

avoid very unlikely race due to EEXIST

parent 659aa061
......@@ -62,11 +62,12 @@ static int ensure_path(char **confpath, const char *path)
if (path) {
if (access(path, W_OK)) {
fd = creat(path, 0600);
if (fd < 0) {
if (fd < 0 && errno != EEXIST) {
SYSERROR("failed to create '%s'", path);
goto err;
}
close(fd);
if (fd >= 0)
close(fd);
}
fullpath = realpath(path, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment