summaryrefslogtreecommitdiff
path: root/src/win32/posix_w32.c
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-02-14 21:23:11 +0100
committerVicent Martí <tanoku@gmail.com>2012-03-03 02:28:00 +0100
commit60bc2d20c40e37e92e4e15479ac4dccbde069bec (patch)
tree0c64df89b9cd66090e2c1665a9a21b19a7113a57 /src/win32/posix_w32.c
parent845f8314e4a02cbd01b2e7d8a6d608d9e9a1334d (diff)
downloadlibgit2-60bc2d20c40e37e92e4e15479ac4dccbde069bec.tar.gz
error-handling: Add new routines
Obviously all the old throw routines are still in place, so we can gradually port over.
Diffstat (limited to 'src/win32/posix_w32.c')
-rw-r--r--src/win32/posix_w32.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index 91585aeae..8e70719f9 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -341,8 +341,12 @@ done:
int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr)
{
#ifdef _MSC_VER
- int len = _vsnprintf(buffer, count, format, argptr);
- return (len < 0) ? _vscprintf(format, argptr) : len;
+ int len;
+
+ if (count == 0 || (len = _vsnprintf(buffer, count, format, argptr)) < 0)
+ return p_vscprintf(format, argptr);
+
+ return len;
#else /* MinGW */
return vsnprintf(buffer, count, format, argptr);
#endif