diff options
| author | Richard M. Stallman | 1998-06-16 04:33:08 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-06-16 04:33:08 +0000 |
| commit | f313ee82af3fb95f4da38ec4483c61f774241255 (patch) | |
| tree | 444ba3b59b1d9931803f2a61c7ae265abfd0f720 /src | |
| parent | 43c158ed152cfcae012c12059fea2d42344f9997 (diff) | |
| download | emacs-f313ee82af3fb95f4da38ec4483c61f774241255.tar.gz emacs-f313ee82af3fb95f4da38ec4483c61f774241255.zip | |
(sys_rename): On some network drives, rename fails with
EACCES instead of EEXIST if target already exists.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -1558,12 +1558,12 @@ sys_rename (const char * oldname, const char * newname) | |||
| 1558 | { | 1558 | { |
| 1559 | /* Force temp name to require a manufactured 8.3 alias - this | 1559 | /* Force temp name to require a manufactured 8.3 alias - this |
| 1560 | seems to make the second rename work properly. */ | 1560 | seems to make the second rename work properly. */ |
| 1561 | sprintf (p, ".%s.%u", o, i); | 1561 | sprintf (p, "_.%s.%u", o, i); |
| 1562 | i++; | 1562 | i++; |
| 1563 | result = rename (oldname, temp); | 1563 | result = rename (oldname, temp); |
| 1564 | } | 1564 | } |
| 1565 | /* This loop must surely terminate! */ | 1565 | /* This loop must surely terminate! */ |
| 1566 | while (result < 0 && errno == EEXIST); | 1566 | while (result < 0 && (errno == EEXIST || errno == EACCES)); |
| 1567 | if (result < 0) | 1567 | if (result < 0) |
| 1568 | return -1; | 1568 | return -1; |
| 1569 | } | 1569 | } |
| @@ -1583,7 +1583,7 @@ sys_rename (const char * oldname, const char * newname) | |||
| 1583 | result = rename (temp, newname); | 1583 | result = rename (temp, newname); |
| 1584 | 1584 | ||
| 1585 | if (result < 0 | 1585 | if (result < 0 |
| 1586 | && errno == EEXIST | 1586 | && (errno == EEXIST || errno == EACCES) |
| 1587 | && _chmod (newname, 0666) == 0 | 1587 | && _chmod (newname, 0666) == 0 |
| 1588 | && _unlink (newname) == 0) | 1588 | && _unlink (newname) == 0) |
| 1589 | result = rename (temp, newname); | 1589 | result = rename (temp, newname); |