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

Commit93001df

Browse files
committed
Don't pass an invalid file handle to dup2(). That causes a crash on
Windows, thanks to a feature in CRT called Parameter Validation.Backpatch to 8.2, which is the oldest version supported on Windows. In8.2 and 8.3 also backpatch the earlier change to use DEVNULL instead ofNULL_DEV #define for a /dev/null-like device. NULL_DEV was hard-coded to"/dev/null" regardless of platform, which didn't work on Windows, whileDEVNULL works on all platforms. Restarting syslogger didn't work onWindows on versions 8.3 and below because of that.
1 parent799c0d3 commit93001df

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎src/backend/postmaster/syslogger.c

Lines changed: 7 additions & 4 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.55 2010/01/02 16:57:51 momjian Exp $
21+
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.56 2010/04/01 20:12:22 heikki Exp $
2222
*
2323
*-------------------------------------------------------------------------
2424
*/
@@ -194,9 +194,12 @@ SysLoggerMain(int argc, char *argv[])
194194
*/
195195
close(fileno(stdout));
196196
close(fileno(stderr));
197-
dup2(fd,fileno(stdout));
198-
dup2(fd,fileno(stderr));
199-
close(fd);
197+
if (fd!=-1)
198+
{
199+
dup2(fd,fileno(stdout));
200+
dup2(fd,fileno(stderr));
201+
close(fd);
202+
}
200203
}
201204

202205
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp