From f20512c849193525788d9cbcead5de2b4de2f32c Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 22 Aug 2010 12:23:43 -0400 Subject: [PATCH] Use pipe() instead of pipe2() - some systems dont have pipe2() --- src/socketengines/socketengine_pipe.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/socketengines/socketengine_pipe.cpp b/src/socketengines/socketengine_pipe.cpp index ee1069d57..0b319f0b0 100644 --- a/src/socketengines/socketengine_pipe.cpp +++ b/src/socketengines/socketengine_pipe.cpp @@ -16,8 +16,12 @@ int Pipe::SendInternal(const Anope::string &) const Pipe::Pipe() : Socket() { int fds[2]; - if (pipe2(fds, O_NONBLOCK)) + if (pipe(fds)) throw CoreException(Anope::string("Could not create pipe: ") + strerror(errno)); + int flags = fcntl(fds[0], F_GETFL, 0); + fcntl(fds[0], F_SETFL, flags | O_NONBLOCK); + flags = fcntl(fds[1], F_GETFL, 0); + fcntl(fds[1], F_SETFL, flags | O_NONBLOCK); this->Sock = fds[0]; this->WritePipe = fds[1];