cataphract                               Sat, 30 Apr 2011 15:56:07 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=310670

Log:
- Fixed build on Solaris.

Changed paths:
    U   php/php-src/trunk/ext/sockets/config.m4
    U   php/php-src/trunk/ext/sockets/multicast.c

Modified: php/php-src/trunk/ext/sockets/config.m4
===================================================================
--- php/php-src/trunk/ext/sockets/config.m4     2011-04-30 15:54:44 UTC (rev 
310669)
+++ php/php-src/trunk/ext/sockets/config.m4     2011-04-30 15:56:07 UTC (rev 
310670)
@@ -18,8 +18,8 @@
     AC_DEFINE(HAVE_CMSGHDR,1,[Whether you have struct cmsghdr])
   fi

-  AC_CHECK_FUNCS([hstrerror socketpair if_nametoindex])
-  AC_CHECK_HEADERS([netdb.h netinet/tcp.h sys/un.h errno.h])
+  AC_CHECK_FUNCS([hstrerror socketpair if_nametoindex if_indextoname])
+  AC_CHECK_HEADERS([netdb.h netinet/tcp.h sys/un.h sys/sockio.h errno.h])
   AC_TRY_COMPILE([
 #include <sys/types.h>
 #include <sys/socket.h>

Modified: php/php-src/trunk/ext/sockets/multicast.c
===================================================================
--- php/php-src/trunk/ext/sockets/multicast.c   2011-04-30 15:54:44 UTC (rev 
310669)
+++ php/php-src/trunk/ext/sockets/multicast.c   2011-04-30 15:56:07 UTC (rev 
310670)
@@ -42,6 +42,9 @@
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
+#ifdef HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #endif
@@ -411,13 +414,24 @@
                out_addr->s_addr = INADDR_ANY;
                return SUCCESS;
        }
-
+
+#if !defined(ifr_ifindex) && defined(ifr_index)
+#define ifr_ifindex ifr_index
+#endif
+
        if_req.ifr_ifindex = if_index;
+#if defined(SIOCGIFNAME)
        if (ioctl(php_sock->bsd_socket, SIOCGIFNAME, &if_req) == -1) {
+#elif defined(HAVE_IF_INDEXTONAME)
+       if (if_indextoname(if_index, if_req.ifr_name) == NULL) {
+#else
+#error Neither SIOCGIFNAME nor if_indextoname are available
+#endif
                php_error_docref(NULL TSRMLS_CC, E_WARNING,
                        "Failed obtaining address for interface %u: error %d", 
if_index, errno);
                return FAILURE;
        }
+
        if (ioctl(php_sock->bsd_socket, SIOCGIFADDR, &if_req) == -1) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING,
                        "Failed obtaining address for interface %u: error %d", 
if_index, errno);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to