CVS update: php3/functions

From: Date: Thu, 20 May 1999 17:01:38 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5814@lists.php.net to get a copy of this message
Date: Thursday May 20, 1999 @ 13:01 Author: sas Update of /repository/php3/functions In directory php:/tmp/cvs-serv29279/functions Modified Files: fsock.c Log Message: - improved error handling - change fgets behaviour to match POSIX.1 Index: php3/functions/fsock.c diff -u php3/functions/fsock.c:1.95 php3/functions/fsock.c:1.96 --- php3/functions/fsock.c:1.95 Thu May 20 12:34:34 1999 +++ php3/functions/fsock.c Thu May 20 13:01:37 1999 @@ -27,7 +27,7 @@ | Jim Winstead (jimw@php.net) | +----------------------------------------------------------------------+ */ -/* $Id: fsock.c,v 1.95 1999/05/20 16:34:34 sas Exp $ */ +/* $Id: fsock.c,v 1.96 1999/05/20 17:01:37 sas Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif @@ -363,7 +363,7 @@ break; } - if(nr_bytes == 0) { + if(nr_bytes == 0 || (nr_bytes < 0 && errno != EWOULDBLOCK)) { sock->eof = 1; } @@ -380,12 +380,17 @@ { char *p; int ret = 0; + size_t amount = 0; SOCK_FIND_AND_READ; p = memchr(READPTR(sock), '\n', MIN(TOREAD(sock), maxlen - 1)); if(p) { - size_t amount = (ptrdiff_t) p - (ptrdiff_t) READPTR(sock) + 1; - + amount = (ptrdiff_t) p - (ptrdiff_t) READPTR(sock) + 1; + } else if(sock->eof && TOREAD(sock) < maxlen) { + amount = TOREAD(sock); + } + + if(amount > 0) { memcpy(buf, READPTR(sock), amount); sock->readpos += amount; @@ -415,7 +420,7 @@ int ret = 0; SOCK_FIND_AND_READ; - if(!TOREAD(sock)) + if(!TOREAD(sock) && sock->eof) ret = 1; return ret; -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5814) next »