[LTP] [PATCH 4/4] syscalls/cachestat01: Use SAFE_FSYNC() instead of fsync()

Avinesh Kumar avinesh.kumar@suse.com
Wed Jul 8 11:11:54 CEST 2026


From: Avinesh Kumar <avinesh.kumar@suse.com>

Success of fsync() is not checked. Use SAFE_FSYNC() instead so that a
failed synchronization is reported instead of being silently ignored.

Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
 testcases/kernel/syscalls/cachestat/cachestat01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/cachestat/cachestat01.c b/testcases/kernel/syscalls/cachestat/cachestat01.c
index 1db530ffe9e5..1ba0f9888f0f 100644
--- a/testcases/kernel/syscalls/cachestat/cachestat01.c
+++ b/testcases/kernel/syscalls/cachestat/cachestat01.c
@@ -42,7 +42,7 @@ static void test_cached_pages(const unsigned int use_sync, const int num_pages)
 		SAFE_WRITE(0, fd, page_data, page_size);
 
 	if (use_sync)
-		fsync(fd);
+		SAFE_FSYNC(fd);
 
 	cs_range->off = 0;
 	cs_range->len = page_size * num_pages;
-- 
2.54.0



More information about the ltp mailing list