summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-02-29 19:40:18 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-02-29 19:40:18 -0500
commit40dc3e0d3bee6ff70fb68d9ba7f0a2ee9da96f68 (patch)
tree6c22669602db29f80b5743b602b22f32e521f7a5 /indra
parent3649eda62ad3a04203e6c562e78815a95896bbd4 (diff)
When constructing a pipe to child stdin on Posix, ignore SIGPIPE.
We can't count on every child process reading everything we try to write to it. And if the child terminates with WritePipe data still pending, unless we explicitly suppress it, Posix will hit us with SIGPIPE. That would terminate the calling process, boom. "Ignoring" it means APR gets the correct errno, passes it back to us, we log it, etc.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llprocess.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp
index edfdebfe87..8ccd39152b 100644
--- a/indra/llcommon/llprocess.cpp
+++ b/indra/llcommon/llprocess.cpp
@@ -145,6 +145,15 @@ public:
mConnection = LLEventPumps::instance().obtain("mainloop")
.listen(LLEventPump::inventName("WritePipe"),
boost::bind(&WritePipeImpl::tick, this, _1));
+
+#if ! LL_WINDOWS
+ // We can't count on every child process reading everything we try to
+ // write to it. And if the child terminates with WritePipe data still
+ // pending, unless we explicitly suppress it, Posix will hit us with
+ // SIGPIPE. That would terminate the viewer, boom. "Ignoring" it means
+ // APR gets the correct errno, passes it back to us, we log it, etc.
+ signal(SIGPIPE, SIG_IGN);
+#endif
}
virtual std::ostream& get_ostream() { return mStream; }