cvs: php4 /ext/sockets config.m4 sockets.c

From: Date: Sun, 12 May 2002 07:22:47 +0000
Subject: cvs: php4 /ext/sockets config.m4 sockets.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11858@lists.php.net to get a copy of this message
jason Sun May 12 03:22:47 2002 EDT Modified files: /php4/ext/sockets config.m4 sockets.c Log: Fix build on IRIX for both mips and gcc Index: php4/ext/sockets/config.m4 diff -u php4/ext/sockets/config.m4:1.8 php4/ext/sockets/config.m4:1.9 --- php4/ext/sockets/config.m4:1.8 Tue Mar 12 11:35:45 2002 +++ php4/ext/sockets/config.m4 Sun May 12 03:22:47 2002 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.8 2002/03/12 16:35:45 sas Exp $ +dnl $Id: config.m4,v 1.9 2002/05/12 07:22:47 jason Exp $ dnl PHP_ARG_ENABLE(sockets, whether to enable sockets support, @@ -9,6 +9,7 @@ AC_CHECK_FUNCS(hstrerror) AC_CHECK_HEADERS(netdb.h netinet/tcp.h sys/un.h errno.h) + AC_CHECK_MEMBER(struct msghdr.msg_flags, , AC_DEFINE(MISSING_MSGHDR_MSGFLAGS, 1, [ ])) AC_DEFINE(HAVE_SOCKETS, 1, [ ]) PHP_NEW_EXTENSION(sockets, sockets.c, $ext_shared) Index: php4/ext/sockets/sockets.c diff -u php4/ext/sockets/sockets.c:1.113 php4/ext/sockets/sockets.c:1.114 --- php4/ext/sockets/sockets.c:1.113 Wed May 8 11:30:04 2002 +++ php4/ext/sockets/sockets.c Sun May 12 03:22:47 2002 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.113 2002/05/08 15:30:04 jason Exp $ */ +/* $Id: sockets.c,v 1.114 2002/05/12 07:22:47 jason Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1513,9 +1513,11 @@ hdr.msg_control = ctl_buf ? ctl_buf : NULL; hdr.msg_controllen = ctl_buf ? Z_LVAL_P(arg4) : 0; +#ifndef MISSING_MSGHDR_MSGFLAGS hdr.msg_flags = 0; - - if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_P(arg5)) != 0) { +#endif + + if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_P(arg5)) < 0) { PHP_SOCKET_ERROR(php_sock, "unable to receive message", errno); RETURN_FALSE; } else { @@ -1528,7 +1530,9 @@ zval_dtor(arg7); ZVAL_LONG(arg4, hdr.msg_controllen); +#ifndef MISSING_MSGHDR_MSGFLAGS ZVAL_LONG(arg5, hdr.msg_flags); +#endif ZVAL_LONG(arg7, ntohs(sin->sin_port)); if (array_init(arg3) == FAILURE) { @@ -1536,9 +1540,11 @@ RETURN_FALSE; } - add_assoc_long(arg3, "cmsg_level", mhdr->cmsg_level); - add_assoc_long(arg3, "cmsg_type", mhdr->cmsg_type); - add_assoc_string(arg3, "cmsg_data", CMSG_DATA(mhdr), 1); + if (mhdr != NULL) { + add_assoc_long(arg3, "cmsg_level", mhdr->cmsg_level); + add_assoc_long(arg3, "cmsg_type", mhdr->cmsg_type); + add_assoc_string(arg3, "cmsg_data", CMSG_DATA(mhdr), 1); + } { char *tmp = inet_ntoa(sin->sin_addr); @@ -1566,8 +1572,10 @@ hdr.msg_control = NULL; hdr.msg_controllen = 0; } - +#ifndef MISSING_MSGHDR_MSGFLAGS hdr.msg_flags = 0; +#endif + if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_P(arg5)) != 0) { PHP_SOCKET_ERROR(php_sock, "unable to receive message", errno); @@ -1583,7 +1591,9 @@ zval_dtor(arg6); ZVAL_LONG(arg4, hdr.msg_controllen); +#ifndef MISSING_MSGHDR_MSGFLAGS ZVAL_LONG(arg5, hdr.msg_flags); +#endif if (array_init(arg3) == FAILURE) { php_error(E_WARNING, "%s() cannot initialize return value", get_active_function_name(TSRMLS_C));

« previous php.cvs (#11858) next »