public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH liburing] test/stdout: fix strcmp non-\0 string
@ 2020-06-16 19:42 Pavel Begunkov
  2020-06-16 19:47 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2020-06-16 19:42 UTC (permalink / raw)
  To: Jens Axboe, io-uring

After copying len(str) bytes of a string, the copy won't necessary have
\0 terminator, that makes test_pipe_io_fixed() to fail. Use memcmp().

Signed-off-by: Pavel Begunkov <[email protected]>
---
 test/stdout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/stdout.c b/test/stdout.c
index 440ea20..ddc9eec 100644
--- a/test/stdout.c
+++ b/test/stdout.c
@@ -84,7 +84,7 @@ static int test_pipe_io_fixed(struct io_uring *ring)
 					(unsigned long) cqe->user_data);
 			goto err;
 		}
-		if (cqe->user_data == 2 && strcmp(str, buffer)) {
+		if (cqe->user_data == 2 && memcmp(str, buffer, strlen(str))) {
 			fprintf(stderr, "read data mismatch\n");
 			goto err;
 		}
-- 
2.24.0


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

end of thread, other threads:[~2020-06-16 19:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-16 19:42 [PATCH liburing] test/stdout: fix strcmp non-\0 string Pavel Begunkov
2020-06-16 19:47 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox