diff --git a/osquery/worker/ipc/posix/pipe_channel_factory.cpp b/osquery/worker/ipc/posix/pipe_channel_factory.cpp index f478a012ba0..1b4b4efc8a5 100644 --- a/osquery/worker/ipc/posix/pipe_channel_factory.cpp +++ b/osquery/worker/ipc/posix/pipe_channel_factory.cpp @@ -21,12 +21,11 @@ PipeChannelTicket::PipeChannelTicket(std::array read_pipe_fds, std::array write_pipe_fds) : read_pipe_fds_(read_pipe_fds), write_pipe_fds_(write_pipe_fds) {} -PipeChannelTicket PipeChannelFactory::createChannelTicket() { - PipeChannelTicket ticket; +Status PipeChannelFactory::createChannelTicket(PipeChannelTicket& ticket) { auto result = pipe(ticket.read_pipe_fds_.data()); if (result == -1) { - throw std::runtime_error( + return Status::failure( "Failed to create parent_write_child_read_pipe, error: " + std::to_string(errno)); } @@ -34,12 +33,12 @@ PipeChannelTicket PipeChannelFactory::createChannelTicket() { result = pipe(ticket.write_pipe_fds_.data()); if (result == -1) { - throw std::runtime_error( + return Status::failure( "Failed to create parent_read_child_write_pipe, error: " + std::to_string(errno)); } - return ticket; + return Status::success(); } PipeChannel& PipeChannelFactory::createChildChannel(