summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-03-14 12:13:03 +0100
committernulltoken <emeric.fermas@gmail.com>2012-04-01 14:33:32 +0200
commit09719c500ca798fea989867f50cf29d4dbed0c89 (patch)
tree8934ccfc5ca281cf3b05fa1d0955ddd03c39d21f /src/fileops.c
parent9273399bdb8f17ba6561de193fd1e518b9691a9a (diff)
downloadlibgit2-09719c500ca798fea989867f50cf29d4dbed0c89.tar.gz
reference: Fix creation of references with extended ASCII characters in their name
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/fileops.c b/src/fileops.c
index f1f820ab7..b3bb3890e 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -62,7 +62,18 @@ int git_futils_creat_withpath(const char *path, const mode_t dirmode, const mode
int git_futils_creat_locked(const char *path, const mode_t mode)
{
- int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_EXCL, mode);
+ int fd;
+
+#ifdef GIT_WIN32
+ wchar_t* buf;
+
+ buf = gitwin_to_utf16(path);
+ fd = _wopen(buf, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_EXCL, mode);
+ git__free(buf);
+#else
+ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_EXCL, mode);
+#endif
+
if (fd < 0) {
giterr_set(GITERR_OS, "Failed to create locked file '%s'", path);
return -1;