All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/2] aio_cancel: Fix incorrect strerror() usage
@ 2026-04-29 14:53 Martin Doucha
  2026-04-29 14:53 ` [LTP] [PATCH v2 2/2] aio_cancel_6-1: Rewrite test Martin Doucha
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Martin Doucha @ 2026-04-29 14:53 UTC (permalink / raw)
  To: ltp

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

Also remove strerror() calls on aio_cancel() return value because
the function does not return errno constants directly.

Fixes: 690b37453 ("aio_cancel_5-1: Rewrite test")
Fixes: 220f579cd ("aio_cancel_7-1: Rewrite test")
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---

Changes since v1:
- Removed strerror() calls on aio_cancel() return value
- Added Fixes: tags

 .../conformance/interfaces/aio_cancel/5-1.c              | 9 +++++----
 .../conformance/interfaces/aio_cancel/7-1.c              | 9 +++++----
 2 files changed, 10 insertions(+), 8 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..0220acd7c 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
@@ -95,8 +95,8 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
 	}
 
 	if (ret != AIO_NOTCANCELED) {
-		printf(TNAME " Unexpected aio_cancel() return value: %s\n",
-			strerror(ret));
+		printf(TNAME " Unexpected aio_cancel() return value: %d\n",
+			ret);
 		cleanup_aio(fds, aiocb, BUF_NB);
 		return PTS_FAIL;
 	}
@@ -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..4bb9d8d09 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
@@ -89,8 +89,8 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
 	}
 
 	if (gret != AIO_NOTCANCELED) {
-		printf(TNAME " Unexpected aio_cancel() return value: %s\n",
-			strerror(gret));
+		printf(TNAME " Unexpected aio_cancel() return value: %d\n",
+			gret);
 		cleanup_aio(fds, aiocb, BUF_NB);
 		return PTS_FAIL;
 	}
@@ -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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-05-07  7:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-29 14:53 [LTP] [PATCH v2 1/2] aio_cancel: Fix incorrect strerror() usage Martin Doucha
2026-04-29 14:53 ` [LTP] [PATCH v2 2/2] aio_cancel_6-1: Rewrite test Martin Doucha
2026-05-06 12:23   ` Andrea Cervesato via ltp
2026-05-06 16:36   ` Cyril Hrubis
2026-05-07  7:32     ` Andrea Cervesato via ltp
2026-04-29 15:20 ` [LTP] aio_cancel: Fix incorrect strerror() usage linuxtestproject.agent
2026-05-06 12:22 ` [LTP] [PATCH v2 1/2] " Andrea Cervesato via ltp
2026-05-06 15:27 ` Cyril Hrubis
2026-05-07  7:34 ` Andrea Cervesato via ltp

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.