From 89b4260c83e3be587b4cb811714622a388c9e950 Mon Sep 17 00:00:00 2001 From: Moritz Grimm Date: Wed, 20 Sep 2017 11:26:35 +0200 Subject: [PATCH] Ensure that dup() succeeds (CID 172001) --- src/ezstream.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ezstream.c b/src/ezstream.c index 83d2782..555a584 100644 --- a/src/ezstream.c +++ b/src/ezstream.c @@ -307,6 +307,10 @@ openResource(stream_t stream, const char *fileName, int *popenFlag, int fd; stderr_fd = dup(fileno(stderr)); + if (0 > stderr_fd) { + log_alert("dup: %s", strerror(errno)); + exit(1); + } if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1) { log_alert("%s: %s", _PATH_DEVNULL, strerror(errno));