From 8b1fa136867cb9af78e0767974f246cfb2977a9d Mon Sep 17 00:00:00 2001 From: steovd Date: Wed, 3 Jan 2024 17:25:46 +0100 Subject: [PATCH] main: allow reading alternative config from pipe --- CHANGELOG.md | 2 ++ main.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38f2c57..72f7eb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ ### Changed * log-level: default to `warning` +* Read alternative config from pipes (e.g. `--config /dev/stdin`) + ([#340][340]). ### Deprecated ### Removed diff --git a/main.c b/main.c index 9604631..3a8b9f7 100644 --- a/main.c +++ b/main.c @@ -223,8 +223,8 @@ main(int argc, char *const *argv) if (stat(optarg, &st) == -1) { fprintf(stderr, "%s: invalid configuration file: %s\n", optarg, strerror(errno)); return EXIT_FAILURE; - } else if (!S_ISREG(st.st_mode)) { - fprintf(stderr, "%s: invalid configuration file: not a regular file\n", + } else if (!S_ISREG(st.st_mode) && !S_ISFIFO(st.st_mode)) { + fprintf(stderr, "%s: invalid configuration file: neither a regular file nor a pipe\n", optarg); return EXIT_FAILURE; }