Fix Windows file read discrepancy.
This commit is contained in:
parent
210d5d276e
commit
f3754fb4e4
|
@ -244,7 +244,7 @@ int file_read_lines(const char* file, void* data, file_line_handler_t handler)
|
|||
return -2;
|
||||
}
|
||||
|
||||
ret = read(fd, buf, MAX_RECV_BUF);
|
||||
ret = read(fd, buf, MAX_RECV_BUF-1);
|
||||
close(fd);
|
||||
|
||||
if (ret < 0)
|
||||
|
@ -258,6 +258,8 @@ int file_read_lines(const char* file, void* data, file_line_handler_t handler)
|
|||
return 0;
|
||||
}
|
||||
|
||||
buf[ret] = 0;
|
||||
|
||||
/* Parse configuration */
|
||||
split_data.handler = handler;
|
||||
split_data.data = data;
|
||||
|
|
Loading…
Reference in New Issue