diff options
Diffstat (limited to 'xorg-server/os/log.c')
-rw-r--r-- | xorg-server/os/log.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c index 671a01bb6..cf0e01518 100644 --- a/xorg-server/os/log.c +++ b/xorg-server/os/log.c @@ -94,8 +94,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" @@ -269,7 +275,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; @@ -286,7 +292,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'); @@ -573,7 +580,7 @@ VAuditF(const char *f, va_list args) if (auditTimer != NULL) TimerForce(auditTimer); ErrorF("%s%s", prefix != NULL ? prefix : "", buf); - strlcpy(oldbuf, buf, sizeof(oldbuf)); + strncpy(oldbuf, buf, sizeof(oldbuf)); oldlen = len; nrepeat = 0; auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL); @@ -581,6 +588,8 @@ VAuditF(const char *f, va_list args) free(prefix); } +extern char g_FatalErrorMessage[1024]; + void FatalError(const char *f, ...) { @@ -601,6 +610,9 @@ FatalError(const char *f, ...) va_end(args2); } #endif +#ifdef WIN32 + vsnprintf(g_FatalErrorMessage, 1024, f, args); +#endif VErrorF(f, args); va_end(args); ErrorF("\n"); |