Skip to contentSkip to conversation

selftests/move_mount_set_group: fix inconsistent return type in move_mount_set_group_supported()

PATCH New Miaoqian Lin 1 participant 1 message Aug 29, 2025 Kselftest

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/move_mount_set_group: fix inconsistent return type in move_mount_set_group_supported()

The function is declared to return bool
but returns -1 on multiple error paths, which is inconsistent and misleading. Fix this by returning false on all error paths.

Fixes 8374f43123a5 ("tests: add move_mount(MOVE_MOUNT_SET_GROUP) selftest")
---
 .../move_mount_set_group_test.c                    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c +7 -7
index bcf51d785a37..3f2c94acb29a 100644
@@ -197,26 +197,26 @@ static bool move_mount_set_group_supported(void)
 
 	if (mount("testing", "/tmp", "tmpfs", MS_NOATIME | MS_NODEV,
 		  "size=100000,mode=700"))
-		return -1;
+		return false;
 
 	if (mount(NULL, "/tmp", NULL, MS_PRIVATE, 0))
-		return -1;
+		return false;
 
 	if (mkdir(SET_GROUP_FROM, 0777))
-		return -1;
+		return false;
 
 	if (mkdir(SET_GROUP_TO, 0777))
-		return -1;
+		return false;
 
 	if (mount("testing", SET_GROUP_FROM, "tmpfs", MS_NOATIME | MS_NODEV,
 		  "size=100000,mode=700"))
-		return -1;
+		return false;
 
 	if (mount(SET_GROUP_FROM, SET_GROUP_TO, NULL, MS_BIND, NULL))
-		return -1;
+		return false;
 
 	if (mount(NULL, SET_GROUP_FROM, NULL, MS_SHARED, 0))
-		return -1;
+		return false;
 
 	ret = syscall(__NR_move_mount, AT_FDCWD, SET_GROUP_FROM,
 		      AT_FDCWD, SET_GROUP_TO, MOVE_MOUNT_SET_GROUP);
Signature · 1 line
2.35.1