From 812e7a73b2d697911b31f612b5f2352343d85614 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 9 Jul 2011 14:28:01 +0200 Subject: [PATCH] [BUG] halog: correctly handle truncated last line If last line is truncated (eg: truncated file), then halog would loop on it forever. --- contrib/halog/fgets2-64.c | 1 + contrib/halog/fgets2.c | 1 + 2 files changed, 2 insertions(+) diff --git a/contrib/halog/fgets2-64.c b/contrib/halog/fgets2-64.c index 236b970dd..9aae45465 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 61d9ef58c..6c5bc6b0a 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; }