summaryrefslogtreecommitdiff
path: root/src/posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/posix.c')
-rw-r--r--src/posix.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/posix.c b/src/posix.c
index 1b85b053d..8c19588ee 100644
--- a/src/posix.c
+++ b/src/posix.c
@@ -17,7 +17,7 @@ int p_open(const char *path, int flags)
return open(path, flags | O_BINARY);
}
-int p_creat(const char *path, int mode)
+int p_creat(const char *path, mode_t mode)
{
return open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, mode);
}
@@ -39,6 +39,20 @@ int p_getcwd(char *buffer_out, size_t size)
return GIT_SUCCESS;
}
+int p_rename(const char *from, const char *to)
+{
+ if (!link(from, to)) {
+ p_unlink(from);
+ return GIT_SUCCESS;
+ }
+
+ if (!rename(from, to))
+ return GIT_SUCCESS;
+
+ return GIT_ERROR;
+
+}
+
#endif
int p_read(git_file fd, void *buf, size_t cnt)