os2: fix the last character of a response file is splitted
For example, if a response file has the following: 0123456789 Then, it is splitted into two arguments, 012345678 and 9. modified: os2.c
This commit is contained in:
parent
8178a963f4
commit
52c47ec69e
4
os2.c
4
os2.c
@ -86,13 +86,13 @@ response(int *argcp, const char ***argvp)
|
||||
filesize = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
line = malloc(filesize + 1);
|
||||
line = malloc(filesize + 1 + 1); /* 1 for type, 1 for NUL */
|
||||
if (!line)
|
||||
goto exit_out_of_memory;
|
||||
|
||||
line[0] = __KLIBC_ARG_NONZERO | __KLIBC_ARG_RESPONSE;
|
||||
l = line + 1;
|
||||
while (fgets(l, filesize - (l - line - 1), f)) {
|
||||
while (fgets(l, (filesize + 1) - (l - (line + 1)), f)) {
|
||||
p = strchr(l, '\n');
|
||||
if (p) {
|
||||
/* if a line ends with '\',
|
||||
|
Loading…
x
Reference in New Issue
Block a user