comparison src/w32.c @ 22501:d2edb98d0fa5

(sys_rename): On some network drives, rename fails with EACCES instead of EEXIST if target already exists.
author Richard M. Stallman <rms@gnu.org>
date Tue, 16 Jun 1998 04:33:08 +0000
parents 921311b43bf4
children d4f3552a85f2
comparison
equal deleted inserted replaced
22500:274456e421ab 22501:d2edb98d0fa5
1556 1556
1557 do 1557 do
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 }
1570 1570
1571 /* Emulate Unix behaviour - newname is deleted if it already exists 1571 /* Emulate Unix behaviour - newname is deleted if it already exists
1581 1581
1582 newname = map_w32_filename (newname, NULL); 1582 newname = map_w32_filename (newname, NULL);
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);
1590 1590
1591 return result; 1591 return result;