From 0365f2ed6630dc9c97ccc34dddb68ea6709b8841 Mon Sep 17 00:00:00 2001 From: fqbuild Date: Sat, 30 Sep 2017 01:27:19 -0700 Subject: [PATCH] options.c: Fix conf.filenames duplication problem if logs are via pipe. fixes allinurl/goaccess#907 --- src/options.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/options.c b/src/options.c index 23c30a9ea5..60c8b07e92 100644 --- a/src/options.c +++ b/src/options.c @@ -674,6 +674,13 @@ verify_global_config (int argc, char **argv) void add_dash_filename (void) { + int i; + // pre-scan for '-' and don't add if already exists: github.com/allinurl/goaccess/issues/907 + for (i = 0; i < conf.filenames_idx; ++i) { + if (conf.filenames[i][0] == '-' && conf.filenames[i][1] == '\0') + return; + } + if (conf.filenames_idx < MAX_FILENAMES && !conf.read_stdin) { conf.read_stdin = 1; conf.filenames[conf.filenames_idx++] = "-";