public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH liburing] test/stdout: fix strcmp non-\0 string
Date: Tue, 16 Jun 2020 22:42:01 +0300	[thread overview]
Message-ID: <ec5c66bd2bf8ae8c190ebf4894f58a039c131845.1592336391.git.asml.silence@gmail.com> (raw)

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


             reply	other threads:[~2020-06-16 19:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 19:42 Pavel Begunkov [this message]
2020-06-16 19:47 ` [PATCH liburing] test/stdout: fix strcmp non-\0 string Jens Axboe

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=ec5c66bd2bf8ae8c190ebf4894f58a039c131845.1592336391.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    /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