From 51c3e9fade76c12e4aa37bffdf800bbf74fb3fb1 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Tue, 27 Sep 2016 01:05:21 -0300 Subject: [PATCH] Include where needed is required by POSIX.1-2001 to get the prototype of select(2), but nearly no systems enforce that because older standards let you get away with including some other headers. Recent OpenBSD hacking has removed that frail touch of friendliness, however, which broke some compiles; fix all the way back to 9.1 by adding the required standard. Only vacuumdb.c was reported to fail, but it seems easier to fix the whole lot in a fell swoop. Per bug #14334 by Sean Farrell. --- src/backend/libpq/auth.c | 3 +++ src/backend/postmaster/pgstat.c | 3 +++ src/bin/pg_basebackup/pg_basebackup.c | 4 +++- src/bin/pg_basebackup/pg_recvlogical.c | 3 +++ src/bin/pg_basebackup/receivelog.c | 3 +++ src/bin/pg_dump/parallel.c | 4 ++++ src/bin/scripts/vacuumdb.c | 4 ++++ src/port/pgsleep.c | 3 +++ src/test/examples/testlibpq2.c | 4 ++++ 9 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index d907e6bc91..0ba8530114 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -20,6 +20,9 @@ #include #include #include +#ifdef HAVE_SYS_SELECT_H +#include +#endif #include "common/ip.h" #include "common/md5.h" diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 8a2ce91344..96578dcedb 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -28,6 +28,9 @@ #include #include #include +#ifdef HAVE_SYS_SELECT_H +#include +#endif #include "pgstat.h" diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 42f3b273a6..d077544d62 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -20,7 +20,9 @@ #include #include #include - +#ifdef HAVE_SYS_SELECT_H +#include +#endif #ifdef HAVE_LIBZ #include #endif diff --git a/src/bin/pg_basebackup/pg_recvlogical.c b/src/bin/pg_basebackup/pg_recvlogical.c index 4c6cf7054e..cb5f989a76 100644 --- a/src/bin/pg_basebackup/pg_recvlogical.c +++ b/src/bin/pg_basebackup/pg_recvlogical.c @@ -15,6 +15,9 @@ #include #include #include +#ifdef HAVE_SYS_SELECT_H +#include +#endif /* local includes */ #include "streamutil.h" diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c index 062730b6b4..3a921ebf2d 100644 --- a/src/bin/pg_basebackup/receivelog.c +++ b/src/bin/pg_basebackup/receivelog.c @@ -16,6 +16,9 @@ #include #include +#ifdef HAVE_SYS_SELECT_H +#include +#endif /* local includes */ #include "receivelog.h" diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c index 4549d11e20..bfd023f3e1 100644 --- a/src/bin/pg_dump/parallel.c +++ b/src/bin/pg_dump/parallel.c @@ -59,6 +59,10 @@ #include "postgres_fe.h" +#ifdef HAVE_SYS_SELECT_H +#include +#endif + #include "parallel.h" #include "pg_backup_utils.h" #include "fe_utils/string_utils.h" diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index c10b58bf0f..32cb0fca2f 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -12,6 +12,10 @@ #include "postgres_fe.h" +#ifdef HAVE_SYS_SELECT_H +#include +#endif + #include "common.h" #include "fe_utils/simple_list.h" #include "fe_utils/string_utils.h" diff --git a/src/port/pgsleep.c b/src/port/pgsleep.c index ef7f7aba6b..ecefe04ec0 100644 --- a/src/port/pgsleep.c +++ b/src/port/pgsleep.c @@ -14,6 +14,9 @@ #include #include +#ifdef HAVE_SYS_SELECT_H +#include +#endif /* * In a Windows backend, we don't use this implementation, but rather diff --git a/src/test/examples/testlibpq2.c b/src/test/examples/testlibpq2.c index 850993f6e8..07c6317a21 100644 --- a/src/test/examples/testlibpq2.c +++ b/src/test/examples/testlibpq2.c @@ -34,6 +34,10 @@ #include #include #include +#ifdef HAVE_SYS_SELECT_H +#include +#endif + #include "libpq-fe.h" static void