summaryrefslogtreecommitdiff
path: root/src/port/dirmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/port/dirmod.c')
-rw-r--r--src/port/dirmod.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index c0c73832991..51ddd875c5f 100644
--- a/src/port/dirmod.c
+++ b/src/port/dirmod.c
@@ -10,20 +10,25 @@
* Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.10 2004/02/02 22:20:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.11 2004/02/25 19:41:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef TEST_VERSION
-#if defined(WIN32) || defined(CYGWIN)
+#if defined(WIN32) || defined(__CYGWIN__)
+
+#ifdef __CYGWIN__
+#include <sys/time.h> /* timeval definition for PG_USLEEP */
+#endif
#ifndef FRONTEND
#include "postgres.h"
#else
#include "postgres_fe.h"
#endif
+#include "miscadmin.h"
#undef rename
#undef unlink
@@ -36,19 +41,19 @@ pgrename(const char *from, const char *to)
#ifdef WIN32
while (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING))
#endif
-#ifdef CYGWIN
+#ifdef __CYGWIN__
while (rename(from, to) < 0)
#endif
{
#ifdef WIN32
if (GetLastError() != ERROR_ACCESS_DENIED)
#endif
-#ifdef CYGWIN
+#ifdef __CYGWIN__
if (errno != EACCES)
#endif
/* set errno? */
return -1;
- Sleep(100); /* ms */
+ PG_USLEEP(100000); /* us */
if (loops == 30)
#ifndef FRONTEND
elog(LOG, "could not rename \"%s\" to \"%s\", continuing to try",
@@ -80,7 +85,7 @@ pgunlink(const char *path)
if (errno != EACCES)
/* set errno? */
return -1;
- Sleep(100); /* ms */
+ PG_USLEEP(100000); /* us */
if (loops == 30)
#ifndef FRONTEND
elog(LOG, "could not unlink \"%s\", continuing to try",