# HG changeset patch # User Richard M. Stallman # Date 897971588 0 # Node ID d2edb98d0fa58ca38a886336d335124aaf85df37 # Parent 274456e421ab07cfa4385595f8264f103c17fbe6 (sys_rename): On some network drives, rename fails with EACCES instead of EEXIST if target already exists. diff -r 274456e421ab -r d2edb98d0fa5 src/w32.c --- a/src/w32.c Tue Jun 16 04:32:03 1998 +0000 +++ b/src/w32.c Tue Jun 16 04:33:08 1998 +0000 @@ -1558,12 +1558,12 @@ { /* 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 @@ result = rename (temp, newname); if (result < 0 - && errno == EEXIST + && (errno == EEXIST || errno == EACCES) && _chmod (newname, 0666) == 0 && _unlink (newname) == 0) result = rename (temp, newname);