From 5fc40f1049933c6875e52ed21211851fa9bfbda6 Mon Sep 17 00:00:00 2001 From: Hailey Somerville Date: Thu, 26 Oct 2023 07:35:25 +1100 Subject: [PATCH] check open syscall error in PipeStream::do_connect (#1150) --- server/streamreader/pipe_stream.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/streamreader/pipe_stream.cpp b/server/streamreader/pipe_stream.cpp index 70984357..65cb2864 100644 --- a/server/streamreader/pipe_stream.cpp +++ b/server/streamreader/pipe_stream.cpp @@ -58,6 +58,9 @@ PipeStream::PipeStream(PcmStream::Listener* pcmListener, boost::asio::io_context void PipeStream::do_connect() { int fd = open(uri_.path.c_str(), O_RDONLY | O_NONBLOCK); + if (fd < 0) + throw SnapException("failed to open fifo \"" + uri_.path + "\": " + cpt::to_string(errno)); + int pipe_size = -1; #if !defined(MACOS) && !defined(FREEBSD) pipe_size = fcntl(fd, F_GETPIPE_SZ);