Skip to contentSkip to conversation

syscalls/statvfs01: Close fd only on success

PATCH In review Cyril Hrubis 2 participants 2 messages Jan 18, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/statvfs01: Close fd only on success

This fixes TBROK in the case that the creat() call has failed unexpectedly and allows the test to continue.

---
 testcases/kernel/syscalls/statvfs/statvfs01.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/statvfs/statvfs01.c +2 -1
index f17dc4cfa..c10c67b18 100644
@@ -42,7 +42,8 @@ static void run(void)
 	toolong_fname[valid_len+1] = 0;
 
 	TST_EXP_FD(creat(valid_fname, 0444));
-	SAFE_CLOSE(TST_RET);
+	if (TST_PASS)
+		SAFE_CLOSE(TST_RET);
 
 	TST_EXP_FAIL(creat(toolong_fname, 0444), ENAMETOOLONG);
 }
Signature · 5 lines
2.38.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi Cyril,

Obviously correct as well, thanks for fixing it.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp