summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-08-22 12:23:43 -0400
committerAdam <Adam@anope.org>2010-08-22 12:23:43 -0400
commitf20512c849193525788d9cbcead5de2b4de2f32c (patch)
tree23187b73a01211bf7e2abf94c498393b8b95f5ef
parentada65a3bafd3ae6738a80972cf0d2f31ad19a7ae (diff)
Use pipe() instead of pipe2() - some systems dont have pipe2()
-rw-r--r--src/socketengines/socketengine_pipe.cpp6
1 files changed, 5 insertions, 1 deletions
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];