From 62d02f39e72a2c030711a772f00f47f51262803c Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Wed, 27 Dec 2017 10:56:14 -0800 Subject: [PATCH] Fix race-under-concurrency in PathNameCreateTemporaryDir. Thomas Munro Discussion: http://postgr.es/m/CAEepm=1Vp1e3KtftLtw4B60ZV9teNeKu6HxoaaBptQMsRWjJbQ@mail.gmail.com --- src/backend/storage/file/fd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 5c7fd645ac..f449ee5c51 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -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", -- 2.40.0