diff options
author | Stefan Pöschel <github@basicmaster.de> | 2018-02-10 00:42:50 +0100 |
---|---|---|
committer | Stefan Pöschel <github@basicmaster.de> | 2018-02-10 00:42:50 +0100 |
commit | 434e6e95a04e96a3265c2394f2304cfb3a932f10 (patch) | |
tree | cca2b530c47081bd242ff8fc25cda005130fee52 /src | |
parent | 2e2db961945de6f46ab0c31e9d5afe9d4a4e28ce (diff) | |
download | ODR-PadEnc-434e6e95a04e96a3265c2394f2304cfb3a932f10.tar.gz ODR-PadEnc-434e6e95a04e96a3265c2394f2304cfb3a932f10.tar.bz2 ODR-PadEnc-434e6e95a04e96a3265c2394f2304cfb3a932f10.zip |
Check output file for being FIFO
Diffstat (limited to 'src')
-rw-r--r-- | src/odr-padenc.cpp | 13 | ||||
-rw-r--r-- | src/odr-padenc.h | 4 |
2 files changed, 15 insertions, 2 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) diff --git a/src/odr-padenc.h b/src/odr-padenc.h index 022ae9c..46290f5 100644 --- a/src/odr-padenc.h +++ b/src/odr-padenc.h @@ -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 @@ -36,8 +36,10 @@ #include <thread> #include <vector> #include <sys/types.h> +#include <sys/stat.h> #include <fcntl.h> #include <getopt.h> +#include <unistd.h> #include "pad_common.h" #include "dls.h" |