Skip to content

Commit 2a95496

Browse files
darcarirafaeljw
authored andcommitted
tools/power turbostat: return the exit status of a command
turbostat failed to return a non-zero exit status even though the supplied command (turbostat <command>) failed. Currently when turbostat forks a command it returns zero instead of the actual exit status of the command. Modify the code to return the exit status. Signed-off-by: David Arcari <[email protected]> Acked-by: Len Brown <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 9e98c67 commit 2a95496

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5077,6 +5077,9 @@ int fork_it(char **argv)
50775077
signal(SIGQUIT, SIG_IGN);
50785078
if (waitpid(child_pid, &status, 0) == -1)
50795079
err(status, "waitpid");
5080+
5081+
if (WIFEXITED(status))
5082+
status = WEXITSTATUS(status);
50805083
}
50815084
/*
50825085
* n.b. fork_it() does not check for errors from for_all_cpus()

0 commit comments

Comments
 (0)