diff options
Diffstat (limited to 'src/w32.c')
| -rw-r--r-- | src/w32.c | 18 |
1 files changed, 15 insertions, 3 deletions
| @@ -3416,7 +3416,13 @@ sys_open (const char * path, int oflag, int mode) | |||
| 3416 | } | 3416 | } |
| 3417 | 3417 | ||
| 3418 | int | 3418 | int |
| 3419 | sys_rename (const char * oldname, const char * newname) | 3419 | fchmod (int fd, mode_t mode) |
| 3420 | { | ||
| 3421 | return 0; | ||
| 3422 | } | ||
| 3423 | |||
| 3424 | int | ||
| 3425 | sys_rename_replace (const char *oldname, const char *newname, BOOL force) | ||
| 3420 | { | 3426 | { |
| 3421 | BOOL result; | 3427 | BOOL result; |
| 3422 | char temp[MAX_PATH]; | 3428 | char temp[MAX_PATH]; |
| @@ -3472,7 +3478,7 @@ sys_rename (const char * oldname, const char * newname) | |||
| 3472 | return -1; | 3478 | return -1; |
| 3473 | } | 3479 | } |
| 3474 | 3480 | ||
| 3475 | /* Emulate Unix behavior - newname is deleted if it already exists | 3481 | /* If FORCE, emulate Unix behavior - newname is deleted if it already exists |
| 3476 | (at least if it is a file; don't do this for directories). | 3482 | (at least if it is a file; don't do this for directories). |
| 3477 | 3483 | ||
| 3478 | Since we mustn't do this if we are just changing the case of the | 3484 | Since we mustn't do this if we are just changing the case of the |
| @@ -3490,7 +3496,7 @@ sys_rename (const char * oldname, const char * newname) | |||
| 3490 | 3496 | ||
| 3491 | result = rename (temp, newname); | 3497 | result = rename (temp, newname); |
| 3492 | 3498 | ||
| 3493 | if (result < 0) | 3499 | if (result < 0 && force) |
| 3494 | { | 3500 | { |
| 3495 | DWORD w32err = GetLastError (); | 3501 | DWORD w32err = GetLastError (); |
| 3496 | 3502 | ||
| @@ -3530,6 +3536,12 @@ sys_rename (const char * oldname, const char * newname) | |||
| 3530 | } | 3536 | } |
| 3531 | 3537 | ||
| 3532 | int | 3538 | int |
| 3539 | sys_rename (char const *old, char const *new) | ||
| 3540 | { | ||
| 3541 | return sys_rename_replace (old, new, TRUE); | ||
| 3542 | } | ||
| 3543 | |||
| 3544 | int | ||
| 3533 | sys_rmdir (const char * path) | 3545 | sys_rmdir (const char * path) |
| 3534 | { | 3546 | { |
| 3535 | return _rmdir (map_w32_filename (path, NULL)); | 3547 | return _rmdir (map_w32_filename (path, NULL)); |