1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00

Ensure that dup() succeeds (CID 172001)

This commit is contained in:
Moritz Grimm 2017-09-20 11:26:35 +02:00
parent 3a471dc164
commit 89b4260c83

View File

@ -307,6 +307,10 @@ openResource(stream_t stream, const char *fileName, int *popenFlag,
int fd; int fd;
stderr_fd = dup(fileno(stderr)); 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) { if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1) {
log_alert("%s: %s", _PATH_DEVNULL, log_alert("%s: %s", _PATH_DEVNULL,
strerror(errno)); strerror(errno));