mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Adjust rename on Win32 to only link to temp name while holding lock,
then release locks and loop over renaming to active file name.
This commit is contained in:
@ -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 */
|
||||
|
Reference in New Issue
Block a user