Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8e1a8fe

Browse files
committed
Fix Windows-specific race condition in syslogger. This could've been
the cause of the "could not write to log file: Bad file descriptor"errors reported athttp://archives.postgresql.org//pgsql-general/2008-06/msg00193.phpBackpatch to 8.3, the race condition was introduced by the CSV loggingpatch.Analysis and patch by Gurjeet Singh.
1 parent029348c commit8e1a8fe

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎src/backend/postmaster/syslogger.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
*
2020
* IDENTIFICATION
21-
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.49 2009/02/24 12:09:09 petere Exp $
21+
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.50 2009/03/18 08:44:49 heikki Exp $
2222
*
2323
*-------------------------------------------------------------------------
2424
*/
@@ -907,13 +907,14 @@ write_syslogger_file(const char *buffer, int count, int destination)
907907
if (destination==LOG_DESTINATION_CSVLOG&&csvlogFile==NULL)
908908
open_csvlogfile();
909909

910-
logfile=destination==LOG_DESTINATION_CSVLOG ?csvlogFile :syslogFile;
911-
912-
#ifndefWIN32
913-
rc=fwrite(buffer,1,count,logfile);
914-
#else
910+
#ifdefWIN32
915911
EnterCriticalSection(&sysfileSection);
912+
#endif
913+
914+
logfile=destination==LOG_DESTINATION_CSVLOG ?csvlogFile :syslogFile;
916915
rc=fwrite(buffer,1,count,logfile);
916+
917+
#ifdefWIN32
917918
LeaveCriticalSection(&sysfileSection);
918919
#endif
919920

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp