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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EA64C433EF for ; Mon, 21 Feb 2022 09:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348436AbiBUJSf (ORCPT ); Mon, 21 Feb 2022 04:18:35 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348716AbiBUJLg (ORCPT ); Mon, 21 Feb 2022 04:11:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E375627CFF; Mon, 21 Feb 2022 01:04:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7EC826112F; Mon, 21 Feb 2022 09:04:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63A08C340EB; Mon, 21 Feb 2022 09:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645434239; bh=shZDmquoMNV8wulGH1i1U7v5/XEgHVECCYKOWyjzupw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fD4bZdcjLOJY9oOKNMZboejr9dALsRvbEF8p6UQ09TAApQ1k/diuI6JwG9di0XGYA SR3ZOTGSVEHo8duiCakxEbMmDcdxc5nFDdiAl9jQzG4WW+mg71+hdi4QmBN5VSW8PX xE52kewgWCAnLpQcfLKFC+cDuHfg52dy8wpzcuzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aleksa Sarai , Cristian Marussi , Shuah Khan , Sasha Levin Subject: [PATCH 5.10 028/121] selftests: openat2: Print also errno in failure messages Date: Mon, 21 Feb 2022 09:48:40 +0100 Message-Id: <20220221084922.128182873@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084921.147454846@linuxfoundation.org> References: <20220221084921.147454846@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cristian Marussi [ Upstream commit e051cdf655fa016692008a446a060eff06222bb5 ] In E_func() macro, on error, print also errno in order to aid debugging. Cc: Aleksa Sarai Signed-off-by: Cristian Marussi Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/openat2/helpers.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/openat2/helpers.h b/tools/testing/selftests/openat2/helpers.h index a6ea27344db2d..ad5d0ba5b6ce9 100644 --- a/tools/testing/selftests/openat2/helpers.h +++ b/tools/testing/selftests/openat2/helpers.h @@ -62,11 +62,12 @@ bool needs_openat2(const struct open_how *how); (similar to chroot(2)). */ #endif /* RESOLVE_IN_ROOT */ -#define E_func(func, ...) \ - do { \ - if (func(__VA_ARGS__) < 0) \ - ksft_exit_fail_msg("%s:%d %s failed\n", \ - __FILE__, __LINE__, #func);\ +#define E_func(func, ...) \ + do { \ + errno = 0; \ + if (func(__VA_ARGS__) < 0) \ + ksft_exit_fail_msg("%s:%d %s failed - errno:%d\n", \ + __FILE__, __LINE__, #func, errno); \ } while (0) #define E_asprintf(...) E_func(asprintf, __VA_ARGS__) -- 2.34.1