]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/tools-power-turbostat-return-the-exit-status-of-a-co.patch
fixes for 5.0
[thirdparty/kernel/stable-queue.git] / queue-4.4 / tools-power-turbostat-return-the-exit-status-of-a-co.patch
CommitLineData
38edc49d
SLM
1From 296bcd6f92fa2c01d94c85b99f6456669c3fe7fc Mon Sep 17 00:00:00 2001
2From: David Arcari <darcari@redhat.com>
3Date: Tue, 12 Feb 2019 09:34:39 -0500
4Subject: tools/power turbostat: return the exit status of a command
5
6[ Upstream commit 2a95496634a017c19641f26f00907af75b962f01 ]
7
8turbostat failed to return a non-zero exit status even though the
9supplied command (turbostat <command>) failed. Currently when turbostat
10forks a command it returns zero instead of the actual exit status of the
11command. Modify the code to return the exit status.
12
13Signed-off-by: David Arcari <darcari@redhat.com>
14Acked-by: Len Brown <len.brown@intel.com>
15Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
16Signed-off-by: Sasha Levin <sashal@kernel.org>
17---
18 tools/power/x86/turbostat/turbostat.c | 3 +++
19 1 file changed, 3 insertions(+)
20
21diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
22index 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--
362.19.1
37