mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-07 13:16:34 +02:00
Issue #216 - Decrement len when no newline
This commit is contained in:
parent
eac30107d3
commit
b9f461dbc5
1 changed files with 2 additions and 1 deletions
|
@ -6187,7 +6187,8 @@ object Cyc_io_read_line(void *data, object cont, object port)
|
||||||
{
|
{
|
||||||
// Remove trailing newline
|
// Remove trailing newline
|
||||||
if (len > 0 && buf[len - 1] == '\n') {
|
if (len > 0 && buf[len - 1] == '\n') {
|
||||||
buf[len - 1] = '\0';
|
len--;
|
||||||
|
buf[len] = '\0';
|
||||||
}
|
}
|
||||||
make_string_noalloc(s, buf, len);
|
make_string_noalloc(s, buf, len);
|
||||||
return_thread_runnable(data, &s);
|
return_thread_runnable(data, &s);
|
||||||
|
|
Loading…
Add table
Reference in a new issue