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
This commit is contained in:
Ethan Yonker
2014-12-29 09:10:34 -06:00
committed by Dees Troy
parent ee8b314dbc
commit f9f99bcb62

View File

@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
#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]);