diff options
-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" |