diff options
Diffstat (limited to 'xorg-server/os/log.c')
-rw-r--r-- | xorg-server/os/log.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c index ee4b45fa4..0d45b7791 100644 --- a/xorg-server/os/log.c +++ b/xorg-server/os/log.c @@ -95,8 +95,14 @@ OR PERFORMANCE OF THIS SOFTWARE. #ifdef WIN32 #include <process.h> +#ifndef _MSC_VER #define getpid(x) _getpid(x) #endif +#endif + +#ifdef _MSC_VER +#define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG) +#endif #ifdef XF86BIGFONT #include "xf86bigfontsrv.h" @@ -268,7 +274,7 @@ LogSetParameter(LogParameter param, int value) void LogVWrite(int verb, const char *f, va_list args) { - static char tmpBuffer[1024]; + char tmpBuffer[1024]; int len = 0; static Bool newline = TRUE; @@ -285,7 +291,8 @@ LogVWrite(int verb, const char *f, va_list args) * stream(s). */ if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) { - vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args); + vsnprintf(tmpBuffer, sizeof(tmpBuffer)-1, f, args); + tmpBuffer[sizeof(tmpBuffer)-1]=0; len = strlen(tmpBuffer); } newline = (tmpBuffer[len-1] == '\n'); @@ -527,6 +534,8 @@ VAuditF(const char *f, va_list args) free(prefix); } +extern char g_FatalErrorMessage[1024]; + void FatalError(const char *f, ...) { @@ -542,6 +551,9 @@ FatalError(const char *f, ...) #ifdef __APPLE__ (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, args); #endif +#ifdef WIN32 + vsnprintf(g_FatalErrorMessage, 1024, f, args); +#endif VErrorF(f, args); va_end(args); ErrorF("\n"); |