aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-01-01 11:24:48 -0600
committerRob Landley <rob@landley.net>2018-01-01 11:24:48 -0600
commit3ba0a289a8c77bc5f103520d8227c0f6695702fb (patch)
tree7cc76b2c669ffc1c740945b3584603304f0e1723
parent736afbadbffcb66fc8b589b35526e7eac5048b68 (diff)
downloadtoybox-3ba0a289a8c77bc5f103520d8227c0f6695702fb.tar.gz
xphung on github said: "config2help currently doesn't work on OS X, it
terminates parsing of Config.in at first blank line. This is because getdelim() in portability.c returns -1 whenever the line comprises only a single linefeed character. Fixing this was a trivial change to two lines (see below), and config2help now works on OS X but I haven't regression tested this on any other commands which rely on getdelim()"
-rw-r--r--lib/portability.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/portability.c b/lib/portability.c
index 78e500b1..38cf5cb9 100644
--- a/lib/portability.c
+++ b/lib/portability.c
@@ -61,9 +61,8 @@ ssize_t getdelim(char **linep, size_t *np, int delim, FILE *stream)
line = *linep = new_line;
}
- line[i] = ch;
+ line[i++] = ch;
if (ch == delim) break;
- i += 1;
}
if (i > *np) {
@@ -74,7 +73,7 @@ ssize_t getdelim(char **linep, size_t *np, int delim, FILE *stream)
*np = new_len;
line = *linep = new_line;
}
- line[i + 1] = '\0';
+ line[i] = '\0';
return i > 0 ? i : -1;
}