Skip to content

Commit

Permalink
tools/power turbostat: return the exit status of a command
Browse files Browse the repository at this point in the history
[ 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]>
  • Loading branch information
darcari authored and gregkh committed Apr 27, 2019
1 parent 3a3e675 commit 63e03ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/power/x86/turbostat/turbostat.c
Original file line number Diff line number Diff line change
Expand Up @@ -3089,6 +3089,9 @@ int fork_it(char **argv)
signal(SIGQUIT, SIG_IGN);
if (waitpid(child_pid, &status, 0) == -1)
err(status, "waitpid");

if (WIFEXITED(status))
status = WEXITSTATUS(status);
}
/*
* n.b. fork_it() does not check for errors from for_all_cpus()
Expand Down

0 comments on commit 63e03ef

Please sign in to comment.