mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-28 00:10:59 -04:00
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)) {
|
while(numread < (*len - 1)) {
|
||||||
to_read = 1;
|
to_read = 1;
|
||||||
if(io_read_timeout(phandle, buf + numread, &to_read, ms)) {
|
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')) {
|
if((!ascii) || (to_read != '\r')) {
|
||||||
numread += to_read;
|
numread += to_read;
|
||||||
if(buf[numread-1] == '\n') {
|
if(buf[numread-1] == '\n') {
|
||||||
@ -917,11 +922,6 @@ int io_readline_timeout(IO_PRIVHANDLE *phandle, unsigned char *buf,
|
|||||||
*len = numread+1;
|
*len = numread+1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if(!to_read) { /* EOF */
|
|
||||||
*len = numread;
|
|
||||||
buf[numread] = '\0';
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user