Chromium Code Reviews| Index: runtime/bin/platform_linux.cc |
| diff --git a/runtime/bin/platform_linux.cc b/runtime/bin/platform_linux.cc |
| index 679f79cf3c242cab7bf5f98f5d05cc3762e564cb..2caf4a8aa7e59b945b3d60025f58baa7772f9809 100644 |
| --- a/runtime/bin/platform_linux.cc |
| +++ b/runtime/bin/platform_linux.cc |
| @@ -4,10 +4,25 @@ |
| #include "bin/platform.h" |
| +#include <signal.h> |
| #include <string.h> |
| #include <unistd.h> |
| +bool Platform::Initialize() { |
| + // Turn off the signal handler for SIGPIPE as it causes the process |
| + // to terminate on writing to a closed pipe. Without the signal |
| + // handler error EPIPE is set instead. |
| + struct sigaction act; |
| + bzero(&act, sizeof(act)); |
| + act.sa_handler = SIG_IGN; |
| + if (sigaction(SIGPIPE, &act, 0) != 0) { |
| + perror("Setting signal handler failed"); |
|
Mads Ager (google)
2011/11/23 12:45:19
return false?
Søren Gjesse
2011/11/23 14:50:18
Absolutely.
|
| + } |
| + return true; |
| +} |
| + |
| + |
| int Platform::NumberOfProcessors() { |
| return sysconf(_SC_NPROCESSORS_ONLN); |
| } |