summaryrefslogtreecommitdiff
path: root/src/w32.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/w32.c b/src/w32.c
index f42b83af60..5a6cb894f5 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -3416,7 +3416,13 @@ sys_open (const char * path, int oflag, int mode)
}
int
-sys_rename (const char * oldname, const char * newname)
+fchmod (int fd, mode_t mode)
+{
+ return 0;
+}
+
+int
+sys_rename_replace (const char *oldname, const char *newname, BOOL force)
{
BOOL result;
char temp[MAX_PATH];
@@ -3472,7 +3478,7 @@ sys_rename (const char * oldname, const char * newname)
return -1;
}
- /* Emulate Unix behavior - newname is deleted if it already exists
+ /* If FORCE, emulate Unix behavior - newname is deleted if it already exists
(at least if it is a file; don't do this for directories).
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)
result = rename (temp, newname);
- if (result < 0)
+ if (result < 0 && force)
{
DWORD w32err = GetLastError ();
@@ -3530,6 +3536,12 @@ sys_rename (const char * oldname, const char * newname)
}
int
+sys_rename (char const *old, char const *new)
+{
+ return sys_rename_replace (old, new, TRUE);
+}
+
+int
sys_rmdir (const char * path)
{
return _rmdir (map_w32_filename (path, NULL));