From f9f99bcb62e569128d7bcb859bb5eed89a0bdf5a Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Mon, 29 Dec 2014 09:10:34 -0600 Subject: Ingore SIGPIPE errors If MTP exits unexpectedly, sending messages to add or remove a storage device via Add_Remove_MTP_Storage was causing a crash. Ignoring SIGPIPE allows us to more gracefully handle the error instead of a total crash of TWRP. Change-Id: I0a3f770f8b0f4bdbe10aa0ba857209b22b8668f7 --- twrp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/twrp.cpp b/twrp.cpp index 24a56f18b..53aab7f66 100644 --- a/twrp.cpp +++ b/twrp.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "cutils/properties.h" extern "C" { @@ -72,6 +73,8 @@ int main(int argc, char **argv) { freopen(TMP_LOG_FILE, "a", stderr); setbuf(stderr, NULL); + signal(SIGPIPE, SIG_IGN); + // Handle ADB sideload if (argc == 3 && strcmp(argv[1], "--adbd") == 0) { adb_main(argv[2]); -- cgit v1.2.3