main: allow reading alternative config from pipe

This commit is contained in:
steovd 2024-01-03 17:25:46 +01:00
parent bdc4fbe8e7
commit 8b1fa13686
2 changed files with 4 additions and 2 deletions

View file

@ -23,6 +23,8 @@
### Changed ### Changed
* log-level: default to `warning` * log-level: default to `warning`
* Read alternative config from pipes (e.g. `--config /dev/stdin`)
([#340][340]).
### Deprecated ### Deprecated
### Removed ### Removed

4
main.c
View file

@ -223,8 +223,8 @@ main(int argc, char *const *argv)
if (stat(optarg, &st) == -1) { if (stat(optarg, &st) == -1) {
fprintf(stderr, "%s: invalid configuration file: %s\n", optarg, strerror(errno)); fprintf(stderr, "%s: invalid configuration file: %s\n", optarg, strerror(errno));
return EXIT_FAILURE; return EXIT_FAILURE;
} else if (!S_ISREG(st.st_mode)) { } else if (!S_ISREG(st.st_mode) && !S_ISFIFO(st.st_mode)) {
fprintf(stderr, "%s: invalid configuration file: not a regular file\n", fprintf(stderr, "%s: invalid configuration file: neither a regular file nor a pipe\n",
optarg); optarg);
return EXIT_FAILURE; return EXIT_FAILURE;
} }