cvs: php4 /ext/standard file.c
| From: | Markus Fischer | Date: | Thu, 21 Mar 2002 22:05:44 +0000 |
| Subject: | cvs: php4 /ext/standard file.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10560@lists.php.net to get a copy of this message | ||
mfischer Thu Mar 21 17:05:44 2002 EDT
Modified files:
/php4/ext/standard file.c
Log:
- Use proper macros for php_stream_cast() return values (fixes #16211).
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.220 php4/ext/standard/file.c:1.221
--- php4/ext/standard/file.c:1.220 Thu Mar 21 14:18:11 2002
+++ php4/ext/standard/file.c Thu Mar 21 17:05:40 2002
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.220 2002/03/21 19:18:11 hholzgra Exp $ */
+/* $Id: file.c,v 1.221 2002/03/21 22:05:40 mfischer Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -785,7 +785,9 @@
if (php_stream_is((php_stream*)what, PHP_STREAM_IS_SOCKET)) {
/* TODO: check if the blocking mode is changed elsewhere, and see if we
* can integrate these calls into php_stream_sock_set_blocking */
- php_stream_cast((php_stream *) what, PHP_STREAM_AS_SOCKETD, (void *) &socketd,
REPORT_ERRORS);
+ if (FAILURE == php_stream_cast((php_stream *) what, PHP_STREAM_AS_SOCKETD, (void *) &socketd,
REPORT_ERRORS)) {
+ RETURN_FALSE;
+ }
if (php_set_sock_blocking(socketd, block) == FAILURE)
RETURN_FALSE;
@@ -1178,7 +1180,7 @@
stream = (php_stream*)zend_fetch_resource(arg1 TSRMLS_CC,-1, "File-Handle", &type,
1, le_stream);
ZEND_VERIFY_RESOURCE(stream);
- if (!php_stream_is(stream, PHP_STREAM_IS_STDIO) || !php_stream_cast(stream, PHP_STREAM_AS_STDIO,
(void**)&fp, REPORT_ERRORS)) {
+ if (!php_stream_is(stream, PHP_STREAM_IS_STDIO) || FAILURE == php_stream_cast(stream,
PHP_STREAM_AS_STDIO, (void**)&fp, REPORT_ERRORS)) {
RETURN_FALSE;
}
@@ -1511,7 +1513,7 @@
php_error(E_WARNING, "can't truncate sockets!");
RETURN_FALSE;
}
- if (php_stream_cast((php_stream*)what, PHP_STREAM_AS_FD, (void*)&fd, 1)) {
+ if (SUCCESS == php_stream_cast((php_stream*)what, PHP_STREAM_AS_FD, (void*)&fd, 1)) {
ret = ftruncate(fd, Z_LVAL_PP(size));
RETURN_LONG(ret + 1);
}
@@ -1541,7 +1543,7 @@
what = zend_fetch_resource(fp TSRMLS_CC,-1, "File-Handle", &type, 1, le_stream);
ZEND_VERIFY_RESOURCE(what);
- if (!php_stream_cast((php_stream*)what, PHP_STREAM_AS_FD, (void*)&fd, 1)) {
+ if (FAILURE == php_stream_cast((php_stream*)what, PHP_STREAM_AS_FD, (void*)&fd, 1)) {
RETURN_FALSE;
}