[PATCH] Re: PHP dies on URL fopen
| From: | J Smith | Date: | Thu, 02 Aug 2001 21:13:15 +0000 |
| Subject: | [PATCH] Re: PHP dies on URL fopen | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-61889@lists.php.net to get a copy of this message | ||
Whoops, forgot to add the do { ... } while(0) in there...
And for some reason, the list serv is bouncing my posts back to me if I
include an attachment, which is why I'm not...
Hope this is useful to someone somewhere...
J
--- oldfsock.c Tue Jul 31 17:27:42 2001
+++ fsock.c Thu Aug 2 16:54:31 2001
@@ -89,10 +89,20 @@
efree(key); \
}
-#define SEARCHCR() do { \
- for (p = READPTR(sock), pe = p + MIN(TOREAD(sock), maxlen); \
- *p != '\n'; ) if (++p >= pe) { p = NULL; break; } \
-} while (0)
+#define SEARCHCR() \
+ do { \
+ if (MIN(TOREAD(sock), maxlen) == 0) \
+ p = NULL; \
+ else { \
+ for (p = READPTR(sock), pe = p + MIN(TOREAD(sock), maxlen); *p !=
'\n';
p++) { \
+ if (p >= pe) { \
+ p = NULL; \
+ break; \
+ } \
+ } \
+ } \
+ } while (0)
+
#ifdef PHP_WIN32
#define EWOULDBLOCK WSAEWOULDBLOCK
@@ -706,7 +716,7 @@
static char * php_sockop_gets(php_stream * stream, char *buf, size_t size)
{
php_sockbuf * sock = (php_sockbuf*)stream->abstract;
- return php_sock_fgets_internal(buf, size, sock);
+ return php_sock_fgets_internal(buf, size, sock);
}
php_stream_ops php_stream_socket_ops = {