[PATCH liburing] test/stdout: fix strcmp non-\0 string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <asml.silence@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux