cvs: php4 /ext/standard file.c
| From: | Stanislav Malyshev | Date: | Sun, 20 Aug 2000 13:24:14 +0000 |
| Subject: | cvs: php4 /ext/standard file.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1257@lists.php.net to get a copy of this message | ||
stas Sun Aug 20 06:24:14 2000 EDT
Modified files:
/php4/ext/standard file.c
Log:
Fix fgetc (#6259) and ftell error condition returns
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.106 php4/ext/standard/file.c:1.107
--- php4/ext/standard/file.c:1.106 Sat Aug 19 22:27:59 2000
+++ php4/ext/standard/file.c Sun Aug 20 06:24:14 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.106 2000/08/20 05:27:59 sas Exp $ */
+/* $Id: file.c,v 1.107 2000/08/20 13:24:14 stas Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -1019,8 +1019,8 @@
socketd=*(int*)what;
}
- buf = emalloc(sizeof(char) * 2);
- if (!(*buf = FP_FGETC(socketd, (FILE*)what, issock))) {
+ buf = emalloc(sizeof(int));
+ if ((*buf = FP_FGETC(socketd, (FILE*)what, issock)) == EOF) {
efree(buf);
RETVAL_FALSE;
} else {
@@ -1320,6 +1320,7 @@
{
pval **arg1;
void *what;
+ long ret;
if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1327,8 +1328,13 @@
what = zend_fetch_resource(arg1,-1,"File-Handle",NULL,2,le_fopen,le_popen);
ZEND_VERIFY_RESOURCE(what);
+
+ ret = ftell((FILE*) what);
+ if(ret == -1) {
+ RETURN_FALSE;
+ }
- RETURN_LONG(ftell((FILE*) what));
+ RETURN_LONG(ret);
}
/* }}} */