From: Willy Tarreau Date: Sat, 9 Jul 2011 12:28:01 +0000 (+0200) Subject: [BUG] halog: correctly handle truncated last line X-Git-Tag: v1.5-dev8~198 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=812e7a73b2d697911b31f612b5f2352343d85614;p=thirdparty%2Fhaproxy.git [BUG] halog: correctly handle truncated last line If last line is truncated (eg: truncated file), then halog would loop on it forever. --- diff --git a/contrib/halog/fgets2-64.c b/contrib/halog/fgets2-64.c index 236b970dd2..9aae45465c 100644 --- a/contrib/halog/fgets2-64.c +++ b/contrib/halog/fgets2-64.c @@ -155,6 +155,7 @@ const char *fgets2(FILE *stream) return NULL; *end = '\0'; + end = line; /* ensure we stop next time */ return line; } diff --git a/contrib/halog/fgets2.c b/contrib/halog/fgets2.c index 61d9ef58c9..6c5bc6b0a9 100644 --- a/contrib/halog/fgets2.c +++ b/contrib/halog/fgets2.c @@ -130,6 +130,7 @@ const char *fgets2(FILE *stream) return NULL; *end = '\0'; + end = line; /* ensure we stop next time */ return line; }