aboutsummaryrefslogtreecommitdiffstats
path: root/src/odr-padenc.cpp
diff options
context:
space:
mode:
authorStefan Pöschel <github@basicmaster.de>2018-02-10 00:42:50 +0100
committerStefan Pöschel <github@basicmaster.de>2018-02-10 00:42:50 +0100
commit434e6e95a04e96a3265c2394f2304cfb3a932f10 (patch)
treecca2b530c47081bd242ff8fc25cda005130fee52 /src/odr-padenc.cpp
parent2e2db961945de6f46ab0c31e9d5afe9d4a4e28ce (diff)
downloadODR-PadEnc-434e6e95a04e96a3265c2394f2304cfb3a932f10.tar.gz
ODR-PadEnc-434e6e95a04e96a3265c2394f2304cfb3a932f10.tar.bz2
ODR-PadEnc-434e6e95a04e96a3265c2394f2304cfb3a932f10.zip
Check output file for being FIFO
Diffstat (limited to 'src/odr-padenc.cpp')
-rw-r--r--src/odr-padenc.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/odr-padenc.cpp b/src/odr-padenc.cpp
index d7f6a86..6506012 100644
--- a/src/odr-padenc.cpp
+++ b/src/odr-padenc.cpp
@@ -3,7 +3,7 @@
Copyright (C) 2014, 2015 Matthias P. Braendli (http://opendigitalradio.org)
- Copyright (C) 2015, 2016, 2017 Stefan Pöschel (http://opendigitalradio.org)
+ Copyright (C) 2015, 2016, 2017, 2018 Stefan Pöschel (http://opendigitalradio.org)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -286,6 +286,17 @@ int PadEncoder::Main() {
return 3;
}
+ // check for FIFO
+ struct stat fifo_stat;
+ if (fstat(output_fd, &fifo_stat)) {
+ perror("ODR-PadEnc Error: could not retrieve output file stat");
+ return 1;
+ }
+ if ((fifo_stat.st_mode & S_IFMT) != S_IFIFO) {
+ fprintf(stderr, "ODR-PadEnc Error: the output file must be a FIFO!\n");
+ return 3;
+ }
+
#if HAVE_MAGICKWAND
MagickWandGenesis();
if (verbose)