Skip to contentSkip to conversation

selftests/filesystems/mount-notify: fix unused result compiler warning

PATCH In review root 2 participants 2 messages Feb 1 – Feb 2

Subsystems (2)
lore
Share & tools
lore

root

author
#0 lore raw

PATCH 1/1 selftests/filesystems/mount-notify: fix unused result compiler warning

From: LJ Fogelstrom <[email protected]>

Compiling with GCC emits Wwarn-unused-result for these two statements, so they are now wrapped in an assert similar to the rest of the code.

(Apologies for sending this twice; I am new and missed to include the maintainers the first time)

---
 .../selftests/filesystems/mount-notify/mount-notify_test.c      | 2 +-
 .../selftests/filesystems/mount-notify/mount-notify_test_ns.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c +1 -1
index 6381af6a40e3..a3ffc07d26e4 100644
@@ -464,7 +464,7 @@ TEST_F(fanotify, rmdir)
 	ASSERT_GE(ret, 0);
 
 	if (ret == 0) {
-		chdir("/");
+		ASSERT_EQ(chdir("/"), 0);
 		unshare(CLONE_NEWNS);
 		mount("", "/", NULL, MS_REC|MS_PRIVATE, NULL);
 		umount2("/a", MNT_DETACH);
tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c +1 -1
index 320ee25dc8a5..0e85e49cb259 100644
@@ -491,7 +491,7 @@ TEST_F(fanotify, rmdir)
 	ASSERT_GE(ret, 0);
 
 	if (ret == 0) {
-		chdir("/");
+		ASSERT_EQ(chdir("/"), 0);
 		unshare(CLONE_NEWNS);
 		mount("", "/", NULL, MS_REC|MS_PRIVATE, NULL);
 		umount2("/a", MNT_DETACH);
Signature · 1 line
2.52.0
#1 lore raw
Quoted 9 lines · root

From: LJ Fogelstrom <[email protected]>

Compiling with GCC emits Wwarn-unused-result for these two statements, so they are now wrapped in an assert similar to the rest of the code.

(Apologies for sending this twice; I am new and missed to include the maintainers the first time)

Don't include this kind of thing in the commit message.

To be honest, I would just ignore the warning. I think the code looks worse at the end.

regards,
dan carpenter