mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
zend_stream_getc uses fread internally. NetWare LibC fread reads 4(Which I believe EOT) for EOF(^D) character. This happens when fread is asked to read one and only character as is the case with cl interactive mode.
-- Kamesh
This commit is contained in:
parent
5fe199fb0f
commit
82da3f5074
1 changed files with 9 additions and 0 deletions
|
@ -102,7 +102,16 @@ ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_
|
||||||
int c = '*';
|
int c = '*';
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
|
#ifdef NETWARE
|
||||||
|
/*
|
||||||
|
c != 4 check is there as fread of a character in NetWare LibC gives 4 upon ^D character.
|
||||||
|
Ascii value 4 is actually EOT character which is not defined anywhere in the LibC
|
||||||
|
or else we can use instead of hardcoded 4.
|
||||||
|
*/
|
||||||
|
for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != 4 && c != '\n'; ++n )
|
||||||
|
#else
|
||||||
for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != '\n'; ++n )
|
for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != '\n'; ++n )
|
||||||
|
#endif
|
||||||
buf[n] = (char) c;
|
buf[n] = (char) c;
|
||||||
if ( c == '\n' )
|
if ( c == '\n' )
|
||||||
buf[n++] = (char) c;
|
buf[n++] = (char) c;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue