From 1d84364c5a224a87f27f9ce3067181b982fa64fc Mon Sep 17 00:00:00 2001 From: oddsock Date: Thu, 27 Feb 2003 03:02:30 +0000 Subject: [PATCH] win32 doesn't support line buffering with setvbuf() properly, so for win32 lets just set it to no-buffering for logs. svn path=/trunk/log/; revision=4381 --- src/log/log.c | 2 +- src/log/log.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/log/log.c b/src/log/log.c index fece9bc9..f1fbaa52 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -103,7 +103,7 @@ int log_open(const char *filename) ret = log_open_file(file); if(ret >= 0) - setvbuf(file, NULL, _IOLBF, 0); + setvbuf(file, NULL, IO_BUFFER_TYPE, 0); return ret; } diff --git a/src/log/log.h b/src/log/log.h index 03fdd628..5a53a876 100644 --- a/src/log/log.h +++ b/src/log/log.h @@ -9,6 +9,11 @@ #define LOG_ENOTOPEN -4 #define LOG_ENOTIMPL -5 +#ifdef _WIN32 +#define IO_BUFFER_TYPE _IONBF +#else +#define IO_BUFFER_TYPE _IOLBF +#endif void log_initialize(); int log_open_file(FILE *file);