1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 03:03:26 +02:00

Fix feof() on win32

Bug #18436
This commit is contained in:
Jason Greene
2002-07-19 20:34:35 +00:00
parent 887e1ffe57
commit 217ef0d115
2 changed files with 11 additions and 2 deletions
+5 -2
View File
@@ -368,9 +368,12 @@ PHPAPI int php_connect_nonb_win32(SOCKET sockfd,
*/
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 @@ printf("read_internal read %d/%d bytes\n", nr_bytes, sock->chunk_size);
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;
}
+6
View File
@@ -43,6 +43,12 @@
# 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>
#endif