Re: cvs: php4 /ext/sockets sockets.c
| From: | Sterling Hughes | Date: | Wed, 19 Sep 2001 12:57:47 +0000 |
| Subject: | Re: cvs: php4 /ext/sockets sockets.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-7469@lists.php.net to get a copy of this message | ||
On Wed, 19 Sep 2001, Wez Furlong wrote:
> wez Wed Sep 19 06:59:14 2001 EDT
>
> Modified files:
> /php4/ext/sockets sockets.c
> Log:
> Fix silly bugs
>
to my knowledge, in accordance with Jason's changes that should be
the bsd_socket entry instead of the socket entry.
-Sterling
> Index: php4/ext/sockets/sockets.c
> diff -u php4/ext/sockets/sockets.c:1.65 php4/ext/sockets/sockets.c:1.66
> --- php4/ext/sockets/sockets.c:1.65 Sun Sep 9 09:29:12 2001
> +++ php4/ext/sockets/sockets.c Wed Sep 19 06:59:12 2001
> @@ -19,7 +19,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: sockets.c,v 1.65 2001/09/09 13:29:12 derick Exp $ */
> +/* $Id: sockets.c,v 1.66 2001/09/19 10:59:12 wez Exp $ */
>
> #ifdef HAVE_CONFIG_H
> #include "config.h"
> @@ -543,7 +543,7 @@
> {
> zval **arg1, **arg2, **arg3, **arg4, **arg5;
> struct timeval tv;
> - php_fd_set *rfds, *wfds, *xfds;
> + php_fd_set *rfds = NULL, *wfds = NULL, *xfds = NULL;
> SOCKET max_fd;
> int sets = 0;
>
> @@ -580,7 +580,10 @@
> tv.tv_sec = Z_LVAL_PP(arg4);
> tv.tv_usec = Z_LVAL_PP(arg5);
>
> - RETURN_LONG(select(max_fd+1, &(rfds->set), &(wfds->set), &(xfds->set),
> &tv));
> + RETURN_LONG(select(max_fd+1, rfds ? &(rfds->set) : NULL,
> + wfds ? &(wfds->set) : NULL,
> + xfds ? &(xfds->set) : NULL,
> + &tv));
> }
> /* }}} */
>
> @@ -682,7 +685,8 @@
> backlog = Z_LVAL_PP(arg2);
> }
>
> - if (listen(php_sock->bsd_socket, backlog) == 0) {
> + if (listen(php_sock->socket, backlog) != 0) {
> + php_error(E_WARNING, "unable to listen [%d]: %s", errno, strerror(errno));
> RETURN_FALSE;
> }
>
> @@ -1068,7 +1072,7 @@
> PHP_FUNCTION(socket_bind)
> {
> zval **arg1, **arg2, **arg3;
> - long retval;
> + long retval = 0;
> php_sockaddr_storage sa_storage;
> struct sockaddr *sock_type = (struct sockaddr*) &sa_storage;
> php_socket *php_sock;
> @@ -1119,7 +1123,7 @@
> }
>
> if (retval != 0) {
> - php_error(E_WARNING, "unable to bind address, %i", errno);
> + php_error(E_WARNING, "unable to bind address, [%i] %s", errno, strerror(errno));
> RETURN_FALSE;
> }
>
>
>
>
>