Skip to content

Commit 1f55a05

Browse files
committed
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.
1 parent 1308f76 commit 1f55a05

File tree

7 files changed

+23
-1
lines changed

7 files changed

+23
-1
lines changed

src/backend/libpq/auth.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
#include <netinet/in.h>
2121
#include <arpa/inet.h>
2222
#include <unistd.h>
23+
#ifdef HAVE_SYS_SELECT_H
24+
#include <sys/select.h>
25+
#endif
2326

2427
#include "libpq/auth.h"
2528
#include "libpq/crypt.h"

src/backend/postmaster/pgstat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
#include <arpa/inet.h>
2929
#include <signal.h>
3030
#include <time.h>
31+
#ifdef HAVE_SYS_SELECT_H
32+
#include <sys/select.h>
33+
#endif
3134

3235
#include "pgstat.h"
3336

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
#include <sys/wait.h>
2424
#include <signal.h>
2525
#include <time.h>
26-
26+
#ifdef HAVE_SYS_SELECT_H
27+
#include <sys/select.h>
28+
#endif
2729
#ifdef HAVE_LIBZ
2830
#include <zlib.h>
2931
#endif

src/bin/pg_basebackup/receivelog.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
/* for ntohl/htonl */
2121
#include <netinet/in.h>
2222
#include <arpa/inet.h>
23+
#ifdef HAVE_SYS_SELECT_H
24+
#include <sys/select.h>
25+
#endif
2326

2427
#include "libpq-fe.h"
2528
#include "access/xlog_internal.h"

src/bin/pg_dump/parallel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959

6060
#include "postgres_fe.h"
6161

62+
#ifdef HAVE_SYS_SELECT_H
63+
#include <sys/select.h>
64+
#endif
65+
6266
#include "pg_backup_utils.h"
6367
#include "parallel.h"
6468

src/port/pgsleep.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
#include <unistd.h>
1616
#include <sys/time.h>
17+
#ifdef HAVE_SYS_SELECT_H
18+
#include <sys/select.h>
19+
#endif
1720

1821
/*
1922
* In a Windows backend, we don't use this implementation, but rather

src/test/examples/testlibpq2.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
#include <errno.h>
3535
#include <sys/time.h>
3636
#include <sys/types.h>
37+
#ifdef HAVE_SYS_SELECT_H
38+
#include <sys/select.h>
39+
#endif
40+
3741
#include "libpq-fe.h"
3842

3943
static void

0 commit comments

Comments
 (0)