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 DD40BC433F5 for ; Wed, 9 Feb 2022 18:43:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240539AbiBISnZ (ORCPT ); Wed, 9 Feb 2022 13:43:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236465AbiBISm0 (ORCPT ); Wed, 9 Feb 2022 13:42:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 827D3C03C184; Wed, 9 Feb 2022 10:41:59 -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 1FB4F6118C; Wed, 9 Feb 2022 18:41:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF869C340E7; Wed, 9 Feb 2022 18:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644432118; bh=shZDmquoMNV8wulGH1i1U7v5/XEgHVECCYKOWyjzupw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MCde9X2ZpR9VXHI+aefuxU7uj7KoRpIOwFSboZv+mklQZ0nB1xi1KWo8IPBetoxXU X67Qrp5A7md1QdH6n8kbF4YaMScOS8sqlzyy78gegqaZLhkEARwdOk+wv3XoCaPsfN iNNfqJ559xihDzN6bypRoR0uEop/58E/TxecZcwkAZQyw1sV1+hkIWuCJzoYXdYXMS mZoYPw3Ouc06l/CI8Bvyxs6C/JO0qEetBzV5NgBlMmq4uP7G6ZGe8XCueboLT+BcbS X2nyIN3fAy4KkUYhON/NCuboGWV/Kjwk80H8zhuaeGTqp0OWPmCqMlfsmD9WFVQPCl Pipnqa3Hr2SsQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Cristian Marussi , Aleksa Sarai , Shuah Khan , Sasha Levin , shuah@kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 09/27] selftests: openat2: Print also errno in failure messages Date: Wed, 9 Feb 2022 13:40:45 -0500 Message-Id: <20220209184103.47635-9-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220209184103.47635-1-sashal@kernel.org> References: <20220209184103.47635-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@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