Linux Test Project
 help / color / mirror / Atom feed
From: Martin Doucha <mdoucha@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] aio_cancel: Fix incorrect strerror() usage
Date: Tue, 28 Apr 2026 15:32:11 +0200	[thread overview]
Message-ID: <20260428133233.28050-1-mdoucha@suse.cz> (raw)

Each call of strerror() invalidates the previous return value. Split
print calls to avoid calling strerror() twice in the argument list.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 .../conformance/interfaces/aio_cancel/5-1.c                  | 5 +++--
 .../conformance/interfaces/aio_cancel/7-1.c                  | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c
index dd5b0bbfb..04306417e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c
@@ -131,8 +131,9 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
 		}
 
 		if (ret != exp_ret) {
-			printf(TNAME " Bad task #%d result: %s (expected %s)\n",
-				i, strerror(ret), strerror(exp_ret));
+			printf(TNAME " Bad task #%d result: %s",
+				i, strerror(ret));
+			printf(" (expected %s)\n", strerror(exp_ret));
 			cleanup_aio(fds, aiocb, BUF_NB);
 			return PTS_FAIL;
 		}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c
index 36ce8bb12..0fdc1bef8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c
@@ -118,8 +118,9 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
 		}
 
 		if (ret != exp_ret) {
-			printf(TNAME " Bad task #%d result: %s (expected %s)\n",
-				i, strerror(ret), strerror(exp_ret));
+			printf(TNAME " Bad task #%d result: %s",
+				i, strerror(ret));
+			printf(" (expected %s)\n", strerror(exp_ret));
 			cleanup_aio(fds, aiocb, BUF_NB);
 			return PTS_FAIL;
 		}
-- 
2.53.0


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

             reply	other threads:[~2026-04-28 13:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 13:32 Martin Doucha [this message]
2026-04-28 14:44 ` [LTP] aio_cancel: Fix incorrect strerror() usage linuxtestproject.agent
2026-04-29  7:13 ` [LTP] [PATCH 1/2] " Andrea Cervesato via ltp

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=20260428133233.28050-1-mdoucha@suse.cz \
    --to=mdoucha@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox