]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/tools-power-turbostat-return-the-exit-status-of-a-co.patch
autosel patches for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / tools-power-turbostat-return-the-exit-status-of-a-co.patch
1 From b1f7e6bbf8a07fa7cb79a310819edd3da8a7193f 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 7a1b20ec5216..d1b2348db0f9 100644
23 --- a/tools/power/x86/turbostat/turbostat.c
24 +++ b/tools/power/x86/turbostat/turbostat.c
25 @@ -4588,6 +4588,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