Install a hopefully-temporary workaround for Snow Leopard readdir() bug.
authorTom Lane <[email protected]>
Sat, 12 Sep 2009 15:51:52 +0000 (15:51 +0000)
committerTom Lane <[email protected]>
Sat, 12 Sep 2009 15:51:52 +0000 (15:51 +0000)
If Apple doesn't fix that reasonably soon, we'll have to consider
back-ing a workaround; but for now, just hack it in HEAD so that
we can get buildfarm reports on HEAD from OS X machines.
Per Jan Otto.

src/backend/commands/tablespace.c

index 75f772f0e4ead50062cc22730cfb1fa0f867a3c4..f119cf056afa324bcb6331e9bc067ce2ff93a2d0 100644 (file)
@@ -612,6 +612,17 @@ remove_tablespace_directories(Oid tablespaceoid, bool redo)
                                                        subfile)));
 
                pfree(subfile);
+
+               /*
+                * OS X 10.6 and 10.6.1 have a bug in readdir() that causes the
+                * next call to fail after deleting the current element.  Hopefully
+                * that will be fixed real soon, but for the moment we have this
+                * ugly kluge to restart the directory scan.
+                */
+#ifdef __darwin__
+               FreeDir(dirdesc);
+               dirdesc = AllocateDir(location);
+#endif
        }
 
        FreeDir(dirdesc);