summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmds/dumpstate/dumpstate.cpp3
-rw-r--r--cmds/dumpstate/utils.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index bb485bfdee..30ddec3371 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -201,7 +201,8 @@ static void dump_systrace() {
execl("/system/bin/atrace", "/system/bin/atrace", "--async_dump", nullptr);
// execl should never return, but if it did, we need to exit.
MYLOGD("execl on '/system/bin/atrace --async_dump' failed: %s", strerror(errno));
- exit(EXIT_FAILURE);
+ // Must call _exit (instead of exit), otherwise it will corrupt the zip file.
+ _exit(EXIT_FAILURE);
} else {
close(pipefd[1]); // close the write end of the pipe in the parent
add_zip_entry_from_fd("systrace.txt", pipefd[0]); // write output to zip file
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 */