From baa85bd893665a48aee73d7ca7b73cd39b48f998 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Tue, 29 Mar 2016 13:29:11 -0700 Subject: Call _exit() instead of exit() on child failure. As explained on man _exit: "The function _exit() terminates the calling process "immediately". Any open file descriptors belonging to the process are closed;" If exit() is called instead, the resulting zip file will be corrupted. BUG: 27900023 BUG: 27804637 Change-Id: I6591749603753d6016f350c629b7082cf6780ae2 --- cmds/dumpstate/utils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cmds/dumpstate/utils.cpp') diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp index 8129852a24..8c0e840050 100644 --- a/cmds/dumpstate/utils.cpp +++ b/cmds/dumpstate/utils.cpp @@ -746,7 +746,8 @@ int run_command_always(const char *title, bool drop_root, int timeout_seconds, c // it's safer to exit dumpstate. MYLOGD("execvp on command '%s' failed (error: %s)", command, strerror(errno)); fflush(stdout); - exit(EXIT_FAILURE); + // Must call _exit (instead of exit), otherwise it will corrupt the zip file. + _exit(EXIT_FAILURE); } /* handle parent case */ -- cgit v1.2.3-59-g8ed1b