From f313ee82af3fb95f4da38ec4483c61f774241255 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 16 Jun 1998 04:33:08 +0000 Subject: [PATCH] (sys_rename): On some network drives, rename fails with EACCES instead of EEXIST if target already exists. --- src/w32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/w32.c b/src/w32.c index da7d29b15a0..f35ebc6523b 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1558,12 +1558,12 @@ sys_rename (const char * oldname, const char * newname) { /* Force temp name to require a manufactured 8.3 alias - this seems to make the second rename work properly. */ - sprintf (p, ".%s.%u", o, i); + sprintf (p, "_.%s.%u", o, i); i++; result = rename (oldname, temp); } /* This loop must surely terminate! */ - while (result < 0 && errno == EEXIST); + while (result < 0 && (errno == EEXIST || errno == EACCES)); if (result < 0) return -1; } @@ -1583,7 +1583,7 @@ sys_rename (const char * oldname, const char * newname) result = rename (temp, newname); if (result < 0 - && errno == EEXIST + && (errno == EEXIST || errno == EACCES) && _chmod (newname, 0666) == 0 && _unlink (newname) == 0) result = rename (temp, newname); -- 2.39.5