Commit 84bdfb2b by Serge Hallyn

avoid very unlikely race due to EEXIST

parent 659aa061
...@@ -62,10 +62,11 @@ static int ensure_path(char **confpath, const char *path) ...@@ -62,10 +62,11 @@ static int ensure_path(char **confpath, const char *path)
if (path) { if (path) {
if (access(path, W_OK)) { if (access(path, W_OK)) {
fd = creat(path, 0600); fd = creat(path, 0600);
if (fd < 0) { if (fd < 0 && errno != EEXIST) {
SYSERROR("failed to create '%s'", path); SYSERROR("failed to create '%s'", path);
goto err; goto err;
} }
if (fd >= 0)
close(fd); close(fd);
} }
......
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