diff --git a/core/stream.c b/core/stream.c index 87f3323..fa7ea46 100644 --- a/core/stream.c +++ b/core/stream.c @@ -386,14 +386,19 @@ enum b_status b_stream_read_line_s(struct b_stream *src, b_stream *dest) break; } + b_stream_write_char(dest, c); + i++; + if (c == '\n') { break; } - - b_stream_write_char(dest, c); } - return B_SUCCESS; + if (status == B_ERR_NO_DATA && i > 0) { + status = B_SUCCESS; + } + + return status; } enum b_status b_stream_read_all_bytes(