From: Richard M. Stallman Date: Tue, 16 Jun 1998 04:33:08 +0000 (+0000) Subject: (sys_rename): On some network drives, rename fails with X-Git-Tag: emacs-20.3~578 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f313ee82af3fb95f4da38ec4483c61f774241255;p=emacs.git (sys_rename): On some network drives, rename fails with EACCES instead of EEXIST if target already exists. --- 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);