Commit
9781a370 ("Handle mblen return code when n is zero.") in glibc
changes the return value for when the number of bytes ('n') is zero.
Add an extra condition to detect if we've reached the end of the buffer.
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
assert(bytes != (size_t)-1);
- /* we'll get a zero size for the nul terminator */
- if (!bytes) {
+ /* we'll get a zero size for the nul terminator, or (size_t) -2
+ * if we've reached the end of the buffer */
+ if (!bytes || bytes == (size_t) -2) {
line_cb(arg, start, end - start);
break;
}