diff options
| author | Bruce Momjian | 2004-02-02 00:17:23 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2004-02-02 00:17:23 +0000 |
| commit | d9d2ca8e8ebb1b1a593d3fe3942370c5d035c990 (patch) | |
| tree | 60df3c075012a0229f0c4f0843ae4b2ab38dd139 /src/port/dirmod.c | |
| parent | e5e5a323ca4485179b647ae333dc4dc6a2e0793d (diff) | |
Adjust rename on Win32 to only link to temp name while holding lock,
then release locks and loop over renaming to active file name.
Diffstat (limited to 'src/port/dirmod.c')
| -rw-r--r-- | src/port/dirmod.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/port/dirmod.c b/src/port/dirmod.c index 15e1290f6d3..45a99216c35 100644 --- a/src/port/dirmod.c +++ b/src/port/dirmod.c @@ -10,7 +10,7 @@ * Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.8 2003/11/29 19:52:13 pgsql Exp $ + * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.9 2004/02/02 00:17:23 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -27,9 +27,19 @@ pgrename(const char *from, const char *to) { int loops = 0; +#ifdef WIN32 while (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING)) +#endif +#ifdef CYGWIN + while (rename(from, to) < 0) +#endif { +#ifdef WIN32 if (GetLastError() != ERROR_ACCESS_DENIED) +#endif +#ifdef CYGWIN + if (errno != EACCES) +#endif /* set errno? */ return -1; Sleep(100); /* ms */ |
