cvs: pecl /memcache memcache.c
| From: | Antony Dovgal | Date: | Thu, 05 Aug 2004 08:16:31 +0000 |
| Subject: | cvs: pecl /memcache memcache.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-1627@lists.php.net to get a copy of this message | ||
tony2001 Thu Aug 5 04:16:31 2004 EDT
Modified files:
/pecl/memcache memcache.c
Log:
fix potential problem with empty datasets (yet another patch from Andrey Nigmatulin <anight at
monamour dot ru>)
http://cvs.php.net/diff.php/pecl/memcache/memcache.c?r1=1.20&r2=1.21&ty=u
Index: pecl/memcache/memcache.c
diff -u pecl/memcache/memcache.c:1.20 pecl/memcache/memcache.c:1.21
--- pecl/memcache/memcache.c:1.20 Tue Jul 20 02:16:37 2004
+++ pecl/memcache/memcache.c Thu Aug 5 04:16:30 2004
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: memcache.c,v 1.20 2004/07/20 06:16:37 tony2001 Exp $ */
+/* $Id: memcache.c,v 1.21 2004/08/05 08:16:30 tony2001 Exp $ */
/* TODO
* - we should probably do a cleanup if some call failed,
@@ -230,7 +230,7 @@
php_info_print_table_start();
php_info_print_table_header(2, "memcache support", "enabled");
php_info_print_table_row(2, "Active persistent connections", buf);
- php_info_print_table_row(2, "Revision", "$Revision: 1.20 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.21 $");
php_info_print_table_end();
}
/* }}} */
@@ -705,14 +705,14 @@
MMC_DEBUG(("mmc_exec_retrieval_cmd: data len is %d bytes", *data_len));
- if (*data_len) {
+ {
int data_to_be_read = *data_len + 2;
int offset = 0;
- *data = emalloc(*data_len + 2 + 1);
+ *data = emalloc(data_to_be_read + 1);
while (data_to_be_read > 0) {
- size = php_stream_read(mmc->stream, *data + offset, *data_len + 2 - offset);
+ size = php_stream_read(mmc->stream, *data + offset, data_to_be_read);
if (size == 0) break;
offset += size, data_to_be_read -= size;
}
@@ -725,10 +725,6 @@
(*data) [*data_len] = '\0';
MMC_DEBUG(("mmc_exec_retrieval_cmd: data '%s'", *data));
- }
- else {
- /* an error occurred? */
- return -1;
}
/* read "END" */