cvs: php4 /main network.c php_network.h

From: Date: Fri, 19 Jul 2002 20:34:35 +0000
Subject: cvs: php4 /main network.c php_network.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12888@lists.php.net to get a copy of this message
jason Fri Jul 19 16:34:35 2002 EDT Modified files: /php4/main network.c php_network.h Log: Fix feof() on win32 Bug #18436 Index: php4/main/network.c diff -u php4/main/network.c:1.52 php4/main/network.c:1.53 --- php4/main/network.c:1.52 Fri Jul 19 12:22:36 2002 +++ php4/main/network.c Fri Jul 19 16:34:35 2002 @@ -15,7 +15,7 @@ | Author: Stig Venaas <venaas@uninett.no> | +----------------------------------------------------------------------+ */ -/* $Id: network.c,v 1.52 2002/07/19 16:22:36 sniper Exp $ */ +/* $Id: network.c,v 1.53 2002/07/19 20:34:35 jason Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ #define MAX_CHUNKS_PER_READ 10 @@ -368,9 +368,12 @@ */ int php_hostconnect(const char *host, unsigned short port, int socktype, int timeout) { - int n, repeatto, s, err; + int n, repeatto, s; struct sockaddr **sal, **psal; struct timeval timeoutval; +#ifdef PHP_WIN32 + int err; +#endif n = php_network_getaddresses(host, &sal); @@ -765,7 +768,7 @@ memcpy(WRITEPTR(sock), buf, nr_bytes); sock->writepos += nr_bytes; nr_read = nr_bytes; - } else if(nr_bytes == 0 || (nr_bytes < 0 && errno != EWOULDBLOCK)) { + } else if(nr_bytes == 0 || (nr_bytes < 0 && streams_socket_errno != EWOULDBLOCK)) { sock->eof = 1; } Index: php4/main/php_network.h diff -u php4/main/php_network.h:1.21 php4/main/php_network.h:1.22 --- php4/main/php_network.h:1.21 Mon Jun 10 23:55:28 2002 +++ php4/main/php_network.h Fri Jul 19 16:34:35 2002 @@ -15,7 +15,7 @@ | Author: Stig Venaas <venaas@uninett.no> | +----------------------------------------------------------------------+ */ -/* $Id: php_network.h,v 1.21 2002/06/11 03:55:28 jason Exp $ */ +/* $Id: php_network.h,v 1.22 2002/07/19 20:34:35 jason Exp $ */ #ifndef _PHP_NETWORK_H #define _PHP_NETWORK_H @@ -42,6 +42,12 @@ # define fsync _commit # define ftruncate(a, b) chsize(a, b) #endif /* defined(PHP_WIN32) */ + +#ifdef PHP_WIN32 +#define streams_socket_errno WSAGetLastError() +#else +#define streams_socket_errno errno +#endif #ifdef HAVE_NETINET_IN_H # include <netinet/in.h>

« previous php.cvs (#12888) next »