]>
Commit | Line | Data |
---|---|---|
38edc49d SLM |
1 | From 296bcd6f92fa2c01d94c85b99f6456669c3fe7fc Mon Sep 17 00:00:00 2001 |
2 | From: David Arcari <darcari@redhat.com> | |
3 | Date: Tue, 12 Feb 2019 09:34:39 -0500 | |
4 | Subject: tools/power turbostat: return the exit status of a command | |
5 | ||
6 | [ Upstream commit 2a95496634a017c19641f26f00907af75b962f01 ] | |
7 | ||
8 | turbostat failed to return a non-zero exit status even though the | |
9 | supplied command (turbostat <command>) failed. Currently when turbostat | |
10 | forks a command it returns zero instead of the actual exit status of the | |
11 | command. Modify the code to return the exit status. | |
12 | ||
13 | Signed-off-by: David Arcari <darcari@redhat.com> | |
14 | Acked-by: Len Brown <len.brown@intel.com> | |
15 | Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | |
16 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
17 | --- | |
18 | tools/power/x86/turbostat/turbostat.c | 3 +++ | |
19 | 1 file changed, 3 insertions(+) | |
20 | ||
21 | diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c | |
22 | index 33c79e415075..532e7bf06868 100644 | |
23 | --- a/tools/power/x86/turbostat/turbostat.c | |
24 | +++ b/tools/power/x86/turbostat/turbostat.c | |
25 | @@ -3089,6 +3089,9 @@ int fork_it(char **argv) | |
26 | signal(SIGQUIT, SIG_IGN); | |
27 | if (waitpid(child_pid, &status, 0) == -1) | |
28 | err(status, "waitpid"); | |
29 | + | |
30 | + if (WIFEXITED(status)) | |
31 | + status = WEXITSTATUS(status); | |
32 | } | |
33 | /* | |
34 | * n.b. fork_it() does not check for errors from for_all_cpus() | |
35 | -- | |
36 | 2.19.1 | |
37 |