*** a/src/backend/postmaster/syslogger.c --- b/src/backend/postmaster/syslogger.c *************** *** 907,920 **** write_syslogger_file(const char *buffer, int count, int destination) if (destination == LOG_DESTINATION_CSVLOG && csvlogFile == NULL) open_csvlogfile(); logfile = destination == LOG_DESTINATION_CSVLOG ? csvlogFile : syslogFile; - #ifndef WIN32 rc = fwrite(buffer, 1, count, logfile); ! #else ! EnterCriticalSection(&sysfileSection); ! rc = fwrite(buffer, 1, count, logfile); ! LeaveCriticalSection(&sysfileSection); #endif /* can't use ereport here because of possible recursion */ --- 907,920 ---- if (destination == LOG_DESTINATION_CSVLOG && csvlogFile == NULL) open_csvlogfile(); + #ifdef WIN32 + EnterCriticalSection(&sysfileSection); + #endif logfile = destination == LOG_DESTINATION_CSVLOG ? csvlogFile : syslogFile; rc = fwrite(buffer, 1, count, logfile); ! #ifdef WIN32 ! LeaveCriticalSection(&sysfileSection); #endif /* can't use ereport here because of possible recursion */