Include <sys/select.h> where needed
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 27 Sep 2016 04:05:21 +0000 (01:05 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 27 Sep 2016 04:05:21 +0000 (01:05 -0300)
<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
src/backend/postmaster/pgstat.c
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/pg_recvlogical.c
src/bin/pg_basebackup/receivelog.c
src/bin/pg_dump/parallel.c
src/port/pgsleep.c
src/test/examples/testlibpq2.c

index 31b56da1e27a9ef257700aeb696390f4952f6167..b6eee179c28b9482cc7055685c657549e50a421b 100644 (file)
@@ -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"
index b2f226cfd9e577938e205676c4911e7cdbbb6860..085b94acfe7c786ac24d7944e69f27d68107087f 100644 (file)
@@ -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"
 
index 204ceccb456ed5d9d915ed5d0cafaf455e31108a..ed78d09dd8f5d9d4c6605ef983d75dcd1592e0f1 100644 (file)
@@ -20,7 +20,9 @@
 #include <sys/wait.h>
 #include <signal.h>
 #include <time.h>
-
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
 #ifdef HAVE_LIBZ
 #include <zlib.h>
 #endif
index 545103be1466b806bbd6240cec59b4358ed811d0..16f755c6ec439691e62ac704bd92183a5ad9c0f5 100644 (file)
@@ -15,6 +15,9 @@
 #include <dirent.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
 
 /* local includes */
 #include "streamutil.h"
index 660116dcec532c8d5be274f72c8072eca5cb9ba8..33ecf20ed45b72124ce728830cd543a00ce49665 100644 (file)
@@ -16,6 +16,9 @@
 
 #include <sys/stat.h>
 #include <unistd.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
 
 /* local includes */
 #include "receivelog.h"
index 5f9f8a33ac2b45a080995053931e7e5734bbe870..e73a16e7cddaecbe34f71d1623a88a5fbebcd04f 100644 (file)
 
 #include "postgres_fe.h"
 
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
 #include "pg_backup_utils.h"
 #include "parallel.h"
 
index 37b4ef99a828048638bd7118892183aba684204d..3e8eaff9b7fd5f10bd96e7f73f5f7d5d7a0650c9 100644 (file)
@@ -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
index 850993f6e82af05ac72dfbc4936307f8b3b63bd1..07c6317a2123dd3b7808bef9895bd35bb9a9cf0e 100644 (file)
 #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