Ignore SIGPIPE is some of the tools used via bugreport

adb bugreport > b & sleep 5; kill $?
will show that a bunch of tools will SIGPIPE when trying to output data
which is normal.
We don't have a way on linux (bsd yes), to set NOSIGPIPE on the file desc
passed down via fork/exec.

Bug: 6447319
Change-Id: I25b30a823addcff89d252f162d0a07035d4fdd3f
This commit is contained in:
JP Abgrall 2012-05-11 14:14:09 -07:00
parent f30fd01497
commit 3e03d3fb6a
2 changed files with 3 additions and 0 deletions

View File

@ -311,6 +311,8 @@ int main(int argc, char *argv[]) {
ALOGI("begin\n");
signal(SIGPIPE, SIG_IGN);
/* set as high priority, and protect from OOM killer */
setpriority(PRIO_PROCESS, 0, -20);
FILE *oom_adj = fopen("/proc/self/oom_adj", "w");

View File

@ -28,6 +28,7 @@ static int sort_func(const String16* lhs, const String16* rhs)
int main(int argc, char* const argv[])
{
signal(SIGPIPE, SIG_IGN);
sp<IServiceManager> sm = defaultServiceManager();
fflush(stdout);
if (sm == NULL) {