summaryrefslogtreecommitdiff
path: root/src/w32.c
diff options
context:
space:
mode:
authorAndrew Innes <andrewi@gnu.org>2000-12-17 23:14:55 +0000
committerAndrew Innes <andrewi@gnu.org>2000-12-17 23:14:55 +0000
commitcfb5e8555e85d10ba7cfad00b53963f7b388fab3 (patch)
tree2ced51d79726974f3ae0f67e8a8d04fcae7f1a01 /src/w32.c
parent2254bcde534143e48b624128a43e86699342b61b (diff)
downloademacs-cfb5e8555e85d10ba7cfad00b53963f7b388fab3.tar.gz
(sys_rename): Only check errno against EEXIST, and not
EACCES, when determining whether rename failed because the target exists. This was resulting in indefinite looping on Windows 9x if the source file was locked by another process.
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/w32.c b/src/w32.c
index efc0bb5511c..abf2db6580b 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1807,7 +1807,7 @@ sys_open (const char * path, int oflag, int mode)
int
sys_rename (const char * oldname, const char * newname)
{
- int result;
+ BOOL result;
char temp[MAX_PATH];
/* MoveFile on Windows 95 doesn't correctly change the short file name
@@ -1851,7 +1851,7 @@ sys_rename (const char * oldname, const char * newname)
result = rename (oldname, temp);
}
/* This loop must surely terminate! */
- while (result < 0 && (errno == EEXIST || errno == EACCES));
+ while (result < 0 && errno == EEXIST);
if (result < 0)
return -1;
}
@@ -1871,7 +1871,7 @@ sys_rename (const char * oldname, const char * newname)
result = rename (temp, newname);
if (result < 0
- && (errno == EEXIST || errno == EACCES)
+ && errno == EEXIST
&& _chmod (newname, 0666) == 0
&& _unlink (newname) == 0)
result = rename (temp, newname);