postgres.git / summary / log / commit / refs
commit e0da2c64197d1a314e404ee2b80f71cd344b974e
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Tue Sep 27 04:05:21 2016 +0000
First released in: 10.0, 9.1.24, 9.2.19, 9.3.15, 9.4.10, 9.5.5, 9.6.1
Include <sys/select.h> where needed
<sys/select.h> 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/receivelog.c | 3 +++
src/port/pgsleep.c | 3 +++
src/test/examples/testlibpq2.c | 4 ++++
6 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index 51d167fdfc0..e5f848ec1b4 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -20,6 +20,9 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
#include "libpq/auth.h"
#include "libpq/crypt.h"
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index ef865174ecb..38f7e70d0a7 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -28,6 +28,9 @@
#include <arpa/inet.h>
#include <signal.h>
#include <time.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
#include "pgstat.h"
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 1140e766bf0..6b88b734ada 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -27,7 +27,9 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
-
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c
index b7f43d5aef0..2e0b52cefb4 100644
--- a/src/bin/pg_basebackup/receivelog.c
+++ b/src/bin/pg_basebackup/receivelog.c
@@ -32,6 +32,9 @@
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
/* Size of the streaming replication protocol headers */
diff --git a/src/port/pgsleep.c b/src/port/pgsleep.c
index 0ebeb6528f0..96d467ef8b3 100644
--- a/src/port/pgsleep.c
+++ b/src/port/pgsleep.c
@@ -14,6 +14,9 @@
#include <unistd.h>
#include <sys/time.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#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 850993f6e82..07c6317a212 100644
--- a/src/test/examples/testlibpq2.c
+++ b/src/test/examples/testlibpq2.c
@@ -34,6 +34,10 @@
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
#include "libpq-fe.h"
static void
[parent: d3af3c01a003]