All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/statvfs01: Close fd only on success
Date: Wed, 18 Jan 2023 16:50:09 +0100	[thread overview]
Message-ID: <20230118155009.16593-1-chrubis@suse.cz> (raw)

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

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/statvfs/statvfs01.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/statvfs/statvfs01.c b/testcases/kernel/syscalls/statvfs/statvfs01.c
index f17dc4cfa..c10c67b18 100644
--- a/testcases/kernel/syscalls/statvfs/statvfs01.c
+++ b/testcases/kernel/syscalls/statvfs/statvfs01.c
@@ -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);
 }
-- 
2.38.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2023-01-18 15:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 15:50 Cyril Hrubis [this message]
2023-01-18 16:42 ` [LTP] [PATCH] syscalls/statvfs01: Close fd only on success Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230118155009.16593-1-chrubis@suse.cz \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.