int SGFile::read( char *buf, int length ) {
// read a chunk
ssize_t result = ::read( fp, buf, length );
- if ( result == 0 ) {
+ if ( length > 0 && result == 0 ) {
eof_flag = true;
}
return result;
// read a chunk
ssize_t result = ::read( fp, buf, length );
- if ( result == 0 ) {
+ if ( length > 0 && result == 0 ) {
eof_flag = true;
}