From b49fb8b4f039085d494538f38a0be9e6998a9706 Mon Sep 17 00:00:00 2001 From: Gerardo O Date: Fri, 22 Dec 2023 11:10:39 -0600 Subject: [PATCH] Fixed regression from commit 1e116d04 preventing stdin data piping. --- src/goaccess.c | 1 + src/parser.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/goaccess.c b/src/goaccess.c index cd27df9c7d..de6a4c9341 100644 --- a/src/goaccess.c +++ b/src/goaccess.c @@ -784,6 +784,7 @@ parse_tail_follow (GLog *glog, FILE *fp) { #endif pthread_mutex_lock (&gdns_thread.mutex); logitem = parse_line (glog, buf, 0); + printf("%s\n", buf); if (logitem != NULL) { if (logitem->errstr == NULL) process_log (logitem); diff --git a/src/parser.c b/src/parser.c index 0392bbd688..46091ae51b 100644 --- a/src/parser.c +++ b/src/parser.c @@ -2078,7 +2078,7 @@ read_lines (FILE *fp, GLog *glog, int dry_run) { } b = 0; - while (!feof (fp)) { // b = 0 or 1 + while (1) { /* b = 0 or 1 */ for (k = 1; k < conf.jobs || (conf.jobs == 1 && k == 1); k++) { #ifdef WITH_GETLINE while ((jobs[b][k].lines[jobs[b][k].p] = fgetline (fp)) != NULL) { @@ -2132,10 +2132,14 @@ read_lines (FILE *fp, GLog *glog, int dry_run) { if (conf.stop_processing) break; + /* check for EOF */ + if (s == NULL) + break; + /* flip from block A/B to B/A */ if (conf.jobs > 1) b = b ^ 1; - } // while (!eof) + } // while (1) /* After eof, process last data */ for (b = 0; b < 2; b++) {