Skip to content

Commit 8bbf227

Browse files
committed
Document why Win32 loops over rename/unlink are necessary.
1 parent e38c920 commit 8bbf227

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/port/dirmod.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.38 2005/08/02 15:14:47 tgl Exp $
13+
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.39 2005/08/10 19:52:37 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -118,7 +118,11 @@ pgrename(const char *from, const char *to)
118118
{
119119
int loops = 0;
120120

121-
/* Is this loop even necessary now that we have win32_open()? */
121+
/*
122+
* We need these loops because even though PostgreSQL uses flags
123+
* that allow rename while the file is open, other applications
124+
* might have these files open without those flags.
125+
*/
122126
#if defined(WIN32) && !defined(__CYGWIN__)
123127
while (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING))
124128
#endif
@@ -164,7 +168,11 @@ pgunlink(const char *path)
164168
{
165169
int loops = 0;
166170

167-
/* Is this loop even necessary now that we have win32_open()? */
171+
/*
172+
* We need these loops because even though PostgreSQL uses flags
173+
* that allow unlink while the file is open, other applications
174+
* might have these files open without those flags.
175+
*/
168176
while (unlink(path))
169177
{
170178
if (errno != EACCES)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy