Block SIGPIPE in IptablesRestoreControllerTest.
Otherwise, testRestartOnMalformedCommand fails most of the time
on sailfish.
Test: netd_unit_test no longer crashes
Change-Id: I546950cd3f4cbaed358020f25a27b70702566e54
diff --git a/server/NetdConstants.cpp b/server/NetdConstants.cpp
index 99f4bf9..0d87264 100644
--- a/server/NetdConstants.cpp
+++ b/server/NetdConstants.cpp
@@ -235,3 +235,12 @@
return rawLength;
}
+
+void blockSigpipe() {
+ sigset_t mask;
+
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGPIPE);
+ if (sigprocmask(SIG_BLOCK, &mask, NULL) != 0)
+ ALOGW("WARNING: SIGPIPE not blocked\n");
+}