OSDN Git Service

Closes stdout when it is redirected to a file.
authorFelipe Leme <felipeal@google.com>
Wed, 11 Nov 2015 01:39:08 +0000 (17:39 -0800)
committerFelipe Leme <felipeal@google.com>
Thu, 12 Nov 2015 00:57:33 +0000 (16:57 -0800)
Bug: 19271141
Change-Id: I2990542649e64bf0a281bb9e322ed7b3b98a75c1

cmds/dumpstate/dumpstate.cpp

index 814b1c2..1c8db6f 100644 (file)
@@ -726,7 +726,6 @@ int main(int argc, char *argv[]) {
 
     /* 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 @@ int main(int argc, char *argv[]) {
         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 */