Commit 62d02f39 authored by Robert Haas's avatar Robert Haas

Fix race-under-concurrency in PathNameCreateTemporaryDir.

Thomas Munro

Discussion: http://postgr.es/m/CAEepm=1Vp1e3KtftLtw4B60ZV9teNeKu6HxoaaBptQMsRWjJbQ@mail.gmail.com
parent 7a727c18
......@@ -1451,7 +1451,7 @@ PathNameCreateTemporaryDir(const char *basedir, const char *directory)
basedir)));
/* Try again. */
if (mkdir(directory, S_IRWXU) < 0)
if (mkdir(directory, S_IRWXU) < 0 && errno != EEXIST)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("cannot create temporary subdirectory \"%s\": %m",
......
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