Skip to content

Commit 009482c

Browse files
Yang Guangshuahkh
authored andcommitted
selftests/move_mount_set_group remove unneeded conversion to bool
The coccinelle report ./tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c:225:18-23: WARNING: conversion to bool not needed here Relational and logical operators evaluate to bool, explicit conversion is overly verbose and unneeded. Reported-by: Zeal Robot <[email protected]> Signed-off-by: Yang Guang <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 6d425d7 commit 009482c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static bool is_shared_mount(const char *path)
191191
#define SET_GROUP_FROM "/tmp/move_mount_set_group_supported_from"
192192
#define SET_GROUP_TO "/tmp/move_mount_set_group_supported_to"
193193

194-
static int move_mount_set_group_supported(void)
194+
static bool move_mount_set_group_supported(void)
195195
{
196196
int ret;
197197

@@ -222,7 +222,7 @@ static int move_mount_set_group_supported(void)
222222
AT_FDCWD, SET_GROUP_TO, MOVE_MOUNT_SET_GROUP);
223223
umount2("/tmp", MNT_DETACH);
224224

225-
return ret < 0 ? false : true;
225+
return ret >= 0;
226226
}
227227

228228
FIXTURE(move_mount_set_group) {
@@ -232,7 +232,7 @@ FIXTURE(move_mount_set_group) {
232232

233233
FIXTURE_SETUP(move_mount_set_group)
234234
{
235-
int ret;
235+
bool ret;
236236

237237
ASSERT_EQ(prepare_unpriv_mountns(), 0);
238238

@@ -254,7 +254,7 @@ FIXTURE_SETUP(move_mount_set_group)
254254

255255
FIXTURE_TEARDOWN(move_mount_set_group)
256256
{
257-
int ret;
257+
bool ret;
258258

259259
ret = move_mount_set_group_supported();
260260
ASSERT_GE(ret, 0);
@@ -348,7 +348,7 @@ TEST_F(move_mount_set_group, complex_sharing_copying)
348348
.shared = false,
349349
};
350350
pid_t pid;
351-
int ret;
351+
bool ret;
352352

353353
ret = move_mount_set_group_supported();
354354
ASSERT_GE(ret, 0);

0 commit comments

Comments
 (0)