10000 Include <sys/select.h> where needed · paul-guo-/postgres@14e2d9a · GitHub
[go: up one dir, main page]

Skip to content

Commit 14e2d9a

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 f83b72e commit 14e2d9a

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-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
@@ -34,6 +34,9 @@
3434
#ifdef HAVE_SYS_POLL_H
3535
#include <sys/poll.h>
3636
#endif
37+
#ifdef HAVE_SYS_SELECT_H
38+
#include <sys/select.h>
39+
#endif
3740

3841
#include "pgstat.h"
3942

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
#include <unistd.h>
1919
#include <dirent.h>
2020
#include <sys/stat.h>
21-
21+
#ifdef HAVE_SYS_SELECT_H
22+
#include <sys/select.h>
23+
#endif
2224
#ifdef HAVE_LIBZ
2325
#include <zlib.h>
2426
#endif

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)
0