cvs: php4(PHP_4_0_7) /ext/sockets sockets.c
| From: | Wez Furlong | Date: | Thu, 20 Sep 2001 15:05:38 +0000 |
| Subject: | cvs: php4(PHP_4_0_7) /ext/sockets sockets.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-7493@lists.php.net to get a copy of this message | ||
wez Thu Sep 20 11:05:38 2001 EDT
Modified files: (Branch: PHP_4_0_7)
/php4/ext/sockets sockets.c
Log:
MFH
Index: php4/ext/sockets/sockets.c
diff -u php4/ext/sockets/sockets.c:1.61.2.1 php4/ext/sockets/sockets.c:1.61.2.2
--- php4/ext/sockets/sockets.c:1.61.2.1 Tue Sep 11 12:08:28 2001
+++ php4/ext/sockets/sockets.c Thu Sep 20 11:05:37 2001
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.61.2.1 2001/09/11 16:08:28 jason Exp $ */
+/* $Id: sockets.c,v 1.61.2.2 2001/09/20 15:05:37 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->bsd_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;
}