Fix for EOF problem without trailing linefeed as reported by evans02472 on the forums
This commit is contained in:
parent
2734480212
commit
491d1038eb
10
src/io.c
10
src/io.c
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue