From 434e6e95a04e96a3265c2394f2304cfb3a932f10 Mon Sep 17 00:00:00 2001 From: Stefan Pöschel Date: Sat, 10 Feb 2018 00:42:50 +0100 Subject: Check output file for being FIFO --- src/odr-padenc.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/odr-padenc.cpp') 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) -- cgit v1.2.3