aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-04-30 15:11:34 -0500
committerRob Landley <rob@landley.net>2015-04-30 15:11:34 -0500
commite7c09548b9c6188857260064c8ceba03d850c4b7 (patch)
treef6c0994c0f27379e3169cad5fa1984705d29aab8 /main.c
parentcb7ed52786ffab798455c88fbd73bc32276bcfed (diff)
downloadtoybox-e7c09548b9c6188857260064c8ceba03d850c4b7.tar.gz
Add default sigpipe handler for android (as suggested by Elliott Hughes).
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.c b/main.c
index 57022442..2fd22d4b 100644
--- a/main.c
+++ b/main.c
@@ -183,8 +183,17 @@ void toybox_main(void)
xputc('\n');
}
+static void shutup_sigpipe(int i)
+{
+ // exit success from sigpipe to mollify overzealous crash reporting.
+ _exit(0);
+}
+
int main(int argc, char *argv[])
{
+ if (CFG_TOYBOX_ON_ANDROID) signal(SIGPIPE, shutup_sigpipe);
+ else signal(SIGPIPE, SIG_IGN);
+
if (CFG_TOYBOX) {
// Trim path off of command name
*argv = basename(*argv);