aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Innes2000-12-17 23:14:55 +0000
committerAndrew Innes2000-12-17 23:14:55 +0000
commitcfb5e8555e85d10ba7cfad00b53963f7b388fab3 (patch)
tree2ced51d79726974f3ae0f67e8a8d04fcae7f1a01 /src
parent2254bcde534143e48b624128a43e86699342b61b (diff)
downloademacs-cfb5e8555e85d10ba7cfad00b53963f7b388fab3.tar.gz
emacs-cfb5e8555e85d10ba7cfad00b53963f7b388fab3.zip
(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')
-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)
1807int 1807int
1808sys_rename (const char * oldname, const char * newname) 1808sys_rename (const char * oldname, const char * newname)
1809{ 1809{
1810 int result; 1810 BOOL result;
1811 char temp[MAX_PATH]; 1811 char temp[MAX_PATH];
1812 1812
1813 /* MoveFile on Windows 95 doesn't correctly change the short file name 1813 /* MoveFile on Windows 95 doesn't correctly change the short file name
@@ -1851,7 +1851,7 @@ sys_rename (const char * oldname, const char * newname)
1851 result = rename (oldname, temp); 1851 result = rename (oldname, temp);
1852 } 1852 }
1853 /* This loop must surely terminate! */ 1853 /* This loop must surely terminate! */
1854 while (result < 0 && (errno == EEXIST || errno == EACCES)); 1854 while (result < 0 && errno == EEXIST);
1855 if (result < 0) 1855 if (result < 0)
1856 return -1; 1856 return -1;
1857 } 1857 }
@@ -1871,7 +1871,7 @@ sys_rename (const char * oldname, const char * newname)
1871 result = rename (temp, newname); 1871 result = rename (temp, newname);
1872 1872
1873 if (result < 0 1873 if (result < 0
1874 && (errno == EEXIST || errno == EACCES) 1874 && errno == EEXIST
1875 && _chmod (newname, 0666) == 0 1875 && _chmod (newname, 0666) == 0
1876 && _unlink (newname) == 0) 1876 && _unlink (newname) == 0)
1877 result = rename (temp, newname); 1877 result = rename (temp, newname);