]> granicus.if.org Git - postgresql/commitdiff
Fix race-under-concurrency in PathNameCreateTemporaryDir.
authorRobert Haas <rhaas@postgresql.org>
Wed, 27 Dec 2017 18:56:14 +0000 (10:56 -0800)
committerRobert Haas <rhaas@postgresql.org>
Wed, 27 Dec 2017 18:56:14 +0000 (10:56 -0800)
Thomas Munro

Discussion: http://postgr.es/m/CAEepm=1Vp1e3KtftLtw4B60ZV9teNeKu6HxoaaBptQMsRWjJbQ@mail.gmail.com

src/backend/storage/file/fd.c

index 5c7fd645ac6844589ac323e423add7a36da79a56..f449ee5c51a3114c029d8db6a2470ff904e0179d 100644 (file)
@@ -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",