Include <sys/select.h> where needed
authorAlvaro Herrera <[email protected]>
Tue, 27 Sep 2016 04:05:21 +0000 (01:05 -0300)
committerAlvaro Herrera <[email protected]>
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 d907e6bc91990c4449ccabd796a84f03c4de421d..0ba85301149a03be96f127b455d179645b23d95a 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 "common/ip.h"
 #include "common/md5.h"
index 8a2ce9134437e4d9e2bf07714a9286de1e194287..96578dcedb5f6b1bb66a6435c26f40b2f0b1113f 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 42f3b273a6281dcc87796483736ce7ac43174717..d077544d62e00ce06716defc76a448600c7150a3 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