Util: Fix VFile.readline
Jeffrey Pfau jeffrey@endrift.com
Thu, 05 Feb 2015 03:18:37 -0800
1 files changed,
3 insertions(+),
2 deletions(-)
jump to
M
src/util/vfs.c
→
src/util/vfs.c
@@ -104,12 +104,13 @@ struct VFileFD* vfd = (struct VFileFD*) vf;
size_t bytesRead = 0; while (bytesRead < size - 1) { size_t newRead = read(vfd->fd, &buffer[bytesRead], 1); - bytesRead += newRead; if (!newRead || buffer[bytesRead] == '\n') { break; } + bytesRead += newRead; } - return buffer[bytesRead] = '\0'; + buffer[bytesRead] = '\0'; + return bytesRead; } ssize_t _vfdWrite(struct VFile* vf, const void* buffer, size_t size) {