177 |
_stdin_file_read (stream_t stream, char *optr, size_t osize, |
_stdin_file_read (stream_t stream, char *optr, size_t osize, |
178 |
off_t offset, size_t *pnbytes) |
off_t offset, size_t *pnbytes) |
179 |
{ |
{ |
180 |
int status; |
int status = 0; |
181 |
size_t nbytes; |
size_t nbytes; |
182 |
struct _file_stream *fs = stream_get_owner (stream); |
struct _file_stream *fs = stream_get_owner (stream); |
183 |
int fs_offset = fs->offset; |
int fs_offset = fs->offset; |
212 |
if (status) |
if (status) |
213 |
return status; |
return status; |
214 |
} |
} |
215 |
|
|
216 |
|
if (feof (fs->file)) |
217 |
|
nbytes = 0; |
218 |
|
else |
219 |
|
{ |
220 |
status = _file_read (stream, optr, osize, fs_offset, &nbytes); |
status = _file_read (stream, optr, osize, fs_offset, &nbytes); |
221 |
if (status == 0 && nbytes) |
if (status == 0 && nbytes) |
222 |
{ |
{ |
227 |
return status; |
return status; |
228 |
if (k != nbytes) |
if (k != nbytes) |
229 |
return EIO; |
return EIO; |
230 |
|
} |
231 |
} |
} |
232 |
if (pnbytes) |
if (pnbytes) |
233 |
*pnbytes = nbytes; |
*pnbytes = nbytes; |