Fix for EOF problem without trailing linefeed as reported by evans02472 on the forums

This commit is contained in:
Ron Pedde 2007-09-09 06:02:03 +00:00
parent 2734480212
commit 491d1038eb
1 changed files with 5 additions and 5 deletions

View File

@ -910,6 +910,11 @@ int io_readline_timeout(IO_PRIVHANDLE *phandle, unsigned char *buf,
while(numread < (*len - 1)) {
to_read = 1;
if(io_read_timeout(phandle, buf + numread, &to_read, ms)) {
if(!to_read) { /* EOF */
*len = numread;
buf[numread] = '\0';
return TRUE;
}
if((!ascii) || (to_read != '\r')) {
numread += to_read;
if(buf[numread-1] == '\n') {
@ -917,11 +922,6 @@ int io_readline_timeout(IO_PRIVHANDLE *phandle, unsigned char *buf,
*len = numread+1;
return TRUE;
}
if(!to_read) { /* EOF */
*len = numread;
buf[numread] = '\0';
return TRUE;
}
}
}
}