Closes stdout when it is redirected to a file.
Bug: 19271141
Change-Id: I2990542649e64bf0a281bb9e322ed7b3b98a75c1
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 814b1c2..1c8db6f 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -726,7 +726,6 @@
/* redirect output if needed */
char path[PATH_MAX], tmp_path[PATH_MAX];
- pid_t gzip_pid = -1;
if (!use_socket && use_outfile) {
strlcpy(path, use_outfile, sizeof(path));
@@ -757,10 +756,9 @@
fclose(vibrator);
}
- /* wait for gzip to finish, otherwise it might get killed when we exit */
- if (gzip_pid > 0) {
+ /* close output if needed */
+ if (!use_socket && use_outfile) {
fclose(stdout);
- waitpid(gzip_pid, NULL, 0);
}
/* rename the (now complete) .tmp file to its final location */