Don't pass an invalid file handle to dup2(). That causes a crash on

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: 311984fabc38911ea75f945c7f41517d5588644d
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2010-04-01T20:12:43Z
Releases: 8.2.17
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. In
8.2 and 8.3 also backpatch the earlier change to use DEVNULL instead of
NULL_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, while
DEVNULL works on all platforms. Restarting syslogger didn't work on
Windows on versions 8.3 and below because of that.

Files

PathChange+/−
src/backend/postmaster/postmaster.c modified +2 −2
src/backend/postmaster/syslogger.c modified +8 −5
src/include/c.h modified +6 −2