This breaks more testcases: ./runtest sed
Was: 3 failure(s) detected; running with -v (verbose) will give more info After patch: 5 failure(s) detected; running with -v (verbose) will give more info On Tue, Sep 6, 2016 at 11:29 AM, Dengke Du <[email protected]> wrote: > In file libbb/get_line_from_file.c, when we read a complete line, > the bb_get_chunk_from_file function meets the '\0' or '\n', it would > break. > > Normally we treate the '\n' as the end of a line, so when we read a > whole line, we would break just in case of '\n', the case of '\0', > we can continue and do nothing. > > Signed-off-by: Dengke Du <[email protected]> > --- > libbb/get_line_from_file.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c > index a98dd35..86804c0 100644 > --- a/libbb/get_line_from_file.c > +++ b/libbb/get_line_from_file.c > @@ -21,9 +21,11 @@ char* FAST_FUNC bb_get_chunk_from_file(FILE *file, int > *end) > /* grow the line buffer as necessary */ > if (!(idx & 0xff)) > linebuf = xrealloc(linebuf, idx + 0x100); > + > + /* if meets the '\0', do nothing and continue */ > + if ((char)ch == '\0') > + continue; > linebuf[idx++] = (char) ch; > - if (ch == '\0') > - break; > if (end && ch == '\n') > break; > } > -- > 2.8.1 > > _______________________________________________ > busybox mailing list > [email protected] > http://lists.busybox.net/mailman/listinfo/busybox _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
