Fix Windows file read discrepancy.

This commit is contained in:
Jan Vidar Krey 2012-05-14 23:33:54 +02:00
parent 210d5d276e
commit f3754fb4e4
1 changed files with 3 additions and 1 deletions

View File

@ -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;