style: cppcheck — drop redundant if(fd>=0) in test_xattr copy-fallback test
EXPECT_TRUE(fd >= 0) already guards; the enclosing if is flagged always-true by cppcheck. read(-1) is safe.
This commit is contained in:
+6
-8
@@ -203,14 +203,12 @@ static void test_link_copy_fallback_preserves_xattrs() {
|
||||
/* Content landed (the copy fallback wrote the caller's bytes). */
|
||||
int fd = open(dest, O_RDONLY);
|
||||
EXPECT_TRUE(fd >= 0);
|
||||
if (fd >= 0) {
|
||||
char buf[16];
|
||||
ssize_t n = read(fd, buf, sizeof(buf));
|
||||
close(fd);
|
||||
EXPECT_EQ_INT((int)strlen("payload"), (int)n);
|
||||
if (n == 7)
|
||||
EXPECT_TRUE(memcmp(buf, "payload", 7) == 0);
|
||||
}
|
||||
char buf[16];
|
||||
ssize_t n = read(fd, buf, sizeof(buf));
|
||||
close(fd);
|
||||
EXPECT_EQ_INT((int)strlen("payload"), (int)n);
|
||||
if (n == 7)
|
||||
EXPECT_TRUE(memcmp(buf, "payload", 7) == 0);
|
||||
/* Per-file xattr applied on the copy. */
|
||||
char vbuf[16];
|
||||
ssize_t vlen = getxattr(dest, "user.fallback", vbuf, sizeof(vbuf));
|
||||
|
||||
Reference in New Issue
Block a user