Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55b42a67 authored by Felipe Leme's avatar Felipe Leme
Browse files

Closes stdout when it is redirected to a file.

Bug: 19271141
Change-Id: I2990542649e64bf0a281bb9e322ed7b3b98a75c1
parent 673b641c
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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 */