Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ccfafb4

Browse files
committed
Suppress useless warning on pre-XP versions of Windows. Magnus
1 parent bbed667 commit ccfafb4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/bin/pg_ctl/pg_ctl.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.71 2006/08/21 10:48:21 meskes Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.72 2006/09/24 16:59:45 tgl Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -1277,7 +1277,15 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo)
12771277
/* Verify that we found all functions */
12781278
if (_IsProcessInJob == NULL || _CreateJobObject == NULL || _SetInformationJobObject == NULL || _AssignProcessToJobObject == NULL || _QueryInformationJobObject == NULL)
12791279
{
1280-
write_stderr("WARNING: Unable to locate all job object functions in system API!\n");
1280+
/* IsProcessInJob() is not available on < WinXP, so there is no need to log the error every time in that case */
1281+
OSVERSIONINFO osv;
1282+
1283+
osv.dwOSVersionInfoSize = sizeof(osv);
1284+
if (!GetVersionEx(&osv) || /* could not get version */
1285+
(osv.dwMajorVersion == 5 && osv.dwMinorVersion > 0) || /* 5.1=xp, 5.2=2003, etc */
1286+
osv.dwMajorVersion > 5) /* anything newer should have the API */
1287+
/* Log error if we can't get version, or if we're on WinXP/2003 or newer */
1288+
write_stderr("WARNING: Unable to locate all job object functions in system API!\n");
12811289
}
12821290
else
12831291
{

0 commit comments

Comments
 (0)