From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BD0FC10F14 for ; Thu, 18 Apr 2019 18:16:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA108206B6 for ; Thu, 18 Apr 2019 18:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555611390; bh=SeCVWR0QRVuWoakR4BoKHO2KCthnFib3wAC/uJpFygw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pzldYOoxKYgfpVwMQgzb20NmPypbHDR16rDx0pw6TTAl5c/NaXuGa7Efy2PrhPqkL GqUqWl3QLC26OOd1qqKRQ8p5m/gmb2/9Yjsnxe+3driC5LlGY42theUdAuY7ZJIqy9 gBNzeEXT7z5lnjr8y9ykxA49Lt3yzT7IkR2AaScc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403976AbfDRSL5 (ORCPT ); Thu, 18 Apr 2019 14:11:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:44188 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403951AbfDRSLx (ORCPT ); Thu, 18 Apr 2019 14:11:53 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9E27920652; Thu, 18 Apr 2019 18:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555611113; bh=SeCVWR0QRVuWoakR4BoKHO2KCthnFib3wAC/uJpFygw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kzfzmQHSKag4z8kT0L5xH1+TOmQQHmXwzfQGx70DDHAjYrClutwGEYqfp4Wl5IQ0i 5KV9bAUUnwS1J6AXHZkZBkBBn15H25UaykLeY8o0T8wjOGfVvKrMaACUpwo96YFMOH 62j8z6M61rl6WADp6k1fO/aQbsmui6EEqfRw4AKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Arcari , Len Brown , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.0 30/93] tools/power turbostat: return the exit status of a command Date: Thu, 18 Apr 2019 19:57:08 +0200 Message-Id: <20190418160439.980614290@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160436.781762249@linuxfoundation.org> References: <20190418160436.781762249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 2a95496634a017c19641f26f00907af75b962f01 ] turbostat failed to return a non-zero exit status even though the supplied command (turbostat ) 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 Acked-by: Len Brown Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- tools/power/x86/turbostat/turbostat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 9327c0ddc3a5..c3fad065c89c 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -5077,6 +5077,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() -- 2.19.1