com php-src: Fix compiler warnings when compiled against musl libc: configure.in main/fastcgi.c main/network.c main/php_network .h
| From: | Jakub Zelenka | Date: | Sun, 30 Apr 2017 19:24:56 +0000 |
| Subject: | com php-src: Fix compiler warnings when compiled against musl libc: configure.in main/fastcgi.c main/network.c main/php_network .h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97734@lists.php.net to get a copy of this message | ||
Commit: d9dfac90bf4bc71c7724fe3777542429a79a5f63
Author: Michael Heimpold <mhei@heimpold.de> Tue, 18 Apr 2017 00:22:34 +0200
Committer: Jakub Zelenka <bukka@php.net> Sun, 30 Apr 2017 20:24:56 +0100
Parents: a0b9554f94a47b32e9771b1be999e255ca6bacc7
Branches: PHP-7.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d9dfac90bf4bc71c7724fe3777542429a79a5f63
Log:
Fix compiler warnings when compiled against musl libc
musl libc is complaining when <sys/poll.h> is used instead of <poll.h>
so change this.
This issue was reported for OpenWrt/LEDE where musl libc is the standard
C library instead of e.g.. glibc, see the following link for the original PR:
https://github.com/openwrt/packages/pull/4263
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
--
v3: refined checks/fallback paths as suggested by @bukka
v2: rebased to resolve merge conflict in main/php_network.h
v1: initial PR
Changed paths:
M configure.in
M main/fastcgi.c
M main/network.c
M main/php_network.h
Diff:
diff --git a/configure.in b/configure.in
index 656892e..d0f20a9 100644
--- a/configure.in
+++ b/configure.in
@@ -494,6 +494,7 @@ limits.h \
locale.h \
monetary.h \
netdb.h \
+poll.h \
pwd.h \
resolv.h \
signal.h \
diff --git a/main/fastcgi.c b/main/fastcgi.c
index 39bfd34..f5e476c 100644
--- a/main/fastcgi.c
+++ b/main/fastcgi.c
@@ -76,7 +76,9 @@ static int is_impersonate = 0;
# include <netdb.h>
# include <signal.h>
-# if defined(HAVE_SYS_POLL_H) && defined(HAVE_POLL)
+# if defined(HAVE_POLL_H) && defined(HAVE_POLL)
+# include <poll.h>
+# elif defined(HAVE_SYS_POLL_H) && defined(HAVE_POLL)
# include <sys/poll.h>
# endif
# if defined(HAVE_SYS_SELECT_H)
@@ -1427,7 +1429,7 @@ int fcgi_accept_request(fcgi_request *req)
break;
#else
if (req->fd >= 0) {
-#if defined(HAVE_SYS_POLL_H) && defined(HAVE_POLL)
+#if defined(HAVE_POLL)
struct pollfd fds;
int ret;
diff --git a/main/network.c b/main/network.c
index 1df2dcd..076608c 100644
--- a/main/network.c
+++ b/main/network.c
@@ -51,7 +51,9 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
-#if HAVE_SYS_POLL_H
+#if HAVE_POLL_H
+#include <poll.h>
+#elif HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
diff --git a/main/php_network.h b/main/php_network.h
index 39035ba..28a9ffd 100644
--- a/main/php_network.h
+++ b/main/php_network.h
@@ -120,8 +120,12 @@ typedef int php_socket_t;
/* uncomment this to debug poll(2) emulation on systems that have poll(2) */
/* #define PHP_USE_POLL_2_EMULATION 1 */
-#if defined(HAVE_SYS_POLL_H) && defined(HAVE_POLL)
-# include <poll.h>
+#if defined(HAVE_POLL)
+# if defined(HAVE_POLL_H)
+# include <poll.h>
+# elif defined(HAVE_SYS_POLL_H)
+# include <sys/poll.h>
+# endif
typedef struct pollfd php_pollfd;
#else
typedef struct _php_pollfd {