From 0e720678af64b1aa6a877e87db1f894b7dba45fa Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 13 Feb 2008 05:48:57 +0000 Subject: [PATCH] Minor Windows fix (thanks, fydo!). --- CHANGELOG | 1 + platform/win32.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1b07bebc..d6a51134 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ -- stuff in the stable-1.0 branch, backported from 2.0.0 dev branch, etc --- +02132008 - Minor Windows fix (thanks, fydo!). 01222008 - Added zlib README, and updated LICENSE.txt. 01212008 - Fixed HTTP header in physfshttpd.c. 12112007 - Fixed incorrect directory test in Windows code (thanks, Buginator!). diff --git a/platform/win32.c b/platform/win32.c index 8f17d6b1..f19f5296 100644 --- a/platform/win32.c +++ b/platform/win32.c @@ -78,8 +78,7 @@ static const char *win32strerror(void) { static TCHAR msgbuf[255]; TCHAR *ptr = msgbuf; - - FormatMessage( + DWORD rc = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, @@ -90,6 +89,9 @@ static const char *win32strerror(void) NULL ); + if (rc == 0) + msgbuf = '\0'; /* oh well. */ + /* chop off newlines. */ for (ptr = msgbuf; *ptr; ptr++) {