Skip to content

Commit 182d264

Browse files
darcarigregkh
authored andcommitted
tools/power turbostat: return the exit status of a command
[ Upstream commit 2a95496 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 3fb2d0a commit 182d264

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
@@ -4588,6 +4588,9 @@ int fork_it(char **argv)
45884588
signal(SIGQUIT, SIG_IGN);
45894589
if (waitpid(child_pid, &status, 0) == -1)
45904590
err(status, "waitpid");
4591+
4592+
if (WIFEXITED(status))
4593+
status = WEXITSTATUS(status);
45914594
}
45924595
/*
45934596
* n.b. fork_it() does not check for errors from for_all_cpus()

0 commit comments

Comments
 (0)