diff options
Diffstat (limited to 'src/win32/posix_w32.c')
-rw-r--r-- | src/win32/posix_w32.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c index a74fcaad1..0023f95ff 100644 --- a/src/win32/posix_w32.c +++ b/src/win32/posix_w32.c @@ -51,6 +51,15 @@ static int utf8_to_16_with_errno(git_win32_path dest, const char *src) return len; } +int p_ftruncate(int fd, long size) +{ +#if defined(_MSC_VER) && _MSC_VER >= 1500 + return _chsize_s(fd, size); +#else + return _chsize(fd, size); +#endif +} + int p_mkdir(const char *path, mode_t mode) { git_win32_path buf; @@ -63,6 +72,14 @@ int p_mkdir(const char *path, mode_t mode) return _wmkdir(buf); } +int p_link(const char *old, const char *new) +{ + GIT_UNUSED(old); + GIT_UNUSED(new); + errno = ENOSYS; + return -1; +} + int p_unlink(const char *path) { git_win32_path buf; @@ -547,11 +564,19 @@ char *p_realpath(const char *orig_path, char *buffer) int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr) { -#if defined(_MSC_VER) && _MSC_VER >= 1500 +#if defined(_MSC_VER) int len; - if (count == 0 || - (len = _vsnprintf_s(buffer, count, _TRUNCATE, format, argptr)) < 0) + if (count == 0) + return _vscprintf(format, argptr); + + #if _MSC_VER >= 1500 + len = _vsnprintf_s(buffer, count, _TRUNCATE, format, argptr); + #else + len = _vsnprintf(buffer, count, format, argptr); + #endif + + if (len < 0) return _vscprintf(format, argptr); return len; |