]> granicus.if.org Git - postgresql/commitdiff
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/port/pgsleep.c
src/test/examples/testlibpq2.c

index 8c6ff8e6efc7612f7afe31a135f01af068a64f6c..58a85348683b6f8c86c2fd3af89106f73598aeea 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 3ee2c07adc21db9f9e3f238c6c5a731ba434c497..86b6c4ce6f7f4bbc6650220f2fbae659ba1e531b 100644 (file)
@@ -34,6 +34,9 @@
 #ifdef HAVE_SYS_POLL_H
 #include <sys/poll.h>
 #endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
 
 #include "pgstat.h"
 
index c78b7ec8853e4b16a427e6aab410d657c5fa6f83..44da062ea17416354aec71a9129d1c1b7cb5f8dd 100644 (file)
@@ -18,7 +18,9 @@
 #include <unistd.h>
 #include <dirent.h>
 #include <sys/stat.h>
-
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
 #ifdef HAVE_LIBZ
 #include <zlib.h>
 #endif
index 988bfb05db1482f5147854e98816a37661a6c2eb..867cf9bf411b57a07a08815796d96c5bd436892c 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