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/bin/scripts/vacuumdb.c
src/port/pgsleep.c
src/test/examples/testlibpq2.c

index 7d8fc3e54d01d66c6fd7431f0ec792e076e31fea..127c6cf45e9f7729d070b3200913d2bb26ea304f 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 2f99aea7912a6865ee0fd06f60b4add851ad07d2..3ff435d6e495b606af41c5b0d189899f935fd8bb 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 ed41db8e6e6ccdb7b06e1020c7dcf1bf9808b13a..80d9dd8c5f04e1e16ff882d0c552ac78d2897539 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 4c6cf7054eb92adef22a1a68c55a5baa0f679083..cb5f989a763bc1618a423ee9f7cf2674d797ffde 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 062730b6b43b5a85580a5087d36fb4966e66fa19..3a921ebf2db03f7a19df3ede7854c0d67c618188 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 4549d11e2023791ab445fea7d2c8400371202a78..bfd023f3e1f608200847f5988807de97a11a1c75 100644 (file)
 
 #include "postgres_fe.h"
 
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
 #include "parallel.h"
 #include "pg_backup_utils.h"
 #include "fe_utils/string_utils.h"
index c10b58bf0fca668780eee3f085d5461e0c48caa3..32cb0fca2f2b34c126e2673b58c68ce0d8c9e9e3 100644 (file)
 
 #include "postgres_fe.h"
 
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
 #include "common.h"
 #include "fe_utils/simple_list.h"
 #include "fe_utils/string_utils.h"
index ef7f7aba6bad9b45b16f8296ba432de98d12f536..ecefe04ec084e96f2155eabf0aa0465edc7d039a 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