netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Shuah Khan <shuah@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Eric Dumazet <edumazet@google.com>, Kees Cook <kees@kernel.org>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	wine-devel@winehq.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>,
	Miklos Szeredi <mszeredi@redhat.com>
Subject: [PATCH v2 11/13] selftests/fs/mount-notify: Fix build warning
Date: Fri,  5 Dec 2025 09:10:05 -0800	[thread overview]
Message-ID: <20251205171010.515236-12-linux@roeck-us.net> (raw)
In-Reply-To: <20251205171010.515236-1-linux@roeck-us.net>

Fix

mount-notify_test.c: In function ‘fanotify_rmdir’:
mount-notify_test.c:467:17: warning:
	ignoring return value of ‘chdir’ declared with attribute ‘warn_unused_result’

by checking the return value of chdir() and displaying an error message
if an error is reported.

Fixes: e1c24b52adb22 ("selftests: add tests for mount notification")
Cc: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Update subject and description to reflect that the patch fixes a build
    warning.
    Use perror() to display an error message if chdir() returns an error.

 .../selftests/filesystems/mount-notify/mount-notify_test.c     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c b/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c
index e4b7c2b457ee..5c929275e689 100644
--- a/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c
+++ b/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c
@@ -464,7 +464,8 @@ TEST_F(fanotify, rmdir)
 	ASSERT_GE(ret, 0);
 
 	if (ret == 0) {
-		chdir("/");
+		if (chdir("/"))
+			perror("chdir()");
 		unshare(CLONE_NEWNS);
 		mount("", "/", NULL, MS_REC|MS_PRIVATE, NULL);
 		umount2("/a", MNT_DETACH);
-- 
2.45.2


  parent reply	other threads:[~2025-12-05 17:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05 17:09 [PATCH v2 00/13] selftests: Fix build warnings and errors Guenter Roeck
2025-12-05 17:09 ` [PATCH v2 01/13] clone3: clone3_cap_checkpoint_restore: Fix build warnings Guenter Roeck
2025-12-05 17:09 ` [PATCH v2 02/13] selftests: ntsync: " Guenter Roeck
2025-12-08 19:27   ` Elizabeth Figura
2025-12-05 17:09 ` [PATCH v2 03/13] selftests/filesystems: fclog: Fix build warnings and errors Guenter Roeck
2025-12-05 17:09 ` [PATCH v2 04/13] selftests/filesystems: file_stressor: Fix build warning Guenter Roeck
2025-12-05 17:09 ` [PATCH v2 05/13] selftests/filesystems: anon_inode_test: " Guenter Roeck
2025-12-05 17:10 ` [PATCH v2 06/13] selftest: af_unix: Support compilers without flex-array-member-not-at-end support Guenter Roeck
2025-12-05 17:10 ` [PATCH v2 07/13] selftest/futex: Comment out test_futex_mpol Guenter Roeck
2025-12-05 17:10 ` [PATCH v2 08/13] selftests: net: netlink-dumps: Avoid uninitialized variable warning Guenter Roeck
2025-12-10  9:13   ` Jakub Kicinski
2025-12-10 19:09     ` Guenter Roeck
2025-12-05 17:10 ` [PATCH v2 09/13] selftests/seccomp: Fix build warning Guenter Roeck
2025-12-05 22:21   ` Kees Cook
2025-12-05 17:10 ` [PATCH v2 10/13] selftests: net: Fix build warnings Guenter Roeck
2025-12-05 17:10 ` Guenter Roeck [this message]
2025-12-05 17:10 ` [PATCH v2 12/13] selftests/fs/mount-notify-ns: Fix build warning Guenter Roeck
2025-12-05 17:31   ` Amir Goldstein
2025-12-05 18:26     ` Guenter Roeck
2025-12-05 17:10 ` [PATCH v2 13/13] selftests: net: tfo: " Guenter Roeck
2025-12-10  9:20 ` [PATCH v2 00/13] selftests: Fix build warnings and errors patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251205171010.515236-12-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=edumazet@google.com \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mszeredi@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wine-devel@winehq.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).