[CRIU] [PATCH 10/10] zdtm/socket-tcp-fin-wait1: Use array index fro TEST_MSG

Dmitry Safonov dima at arista.com
Fri Nov 22 00:56:43 MSK 2019


Fixes the following compile-error:
>  CC        socket-tcp-fin-wait1.o
> socket-tcp-fin-wait1.c:144:26: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
>                 if (write(fd, TEST_MSG + 2, sizeof(TEST_MSG) - 2) != sizeof(TEST_MSG) - 2) {
>                               ~~~~~~~~~^~~
> socket-tcp-fin-wait1.c:144:26: note: use array indexing to silence this warning
>                 if (write(fd, TEST_MSG + 2, sizeof(TEST_MSG) - 2) != sizeof(TEST_MSG) - 2) {
>                                        ^
>                               &        [  ]
> 1 error generated.

Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 test/zdtm/static/socket-tcp-fin-wait1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/zdtm/static/socket-tcp-fin-wait1.c b/test/zdtm/static/socket-tcp-fin-wait1.c
index 6c7cc93e5644..50da9c152897 100644
--- a/test/zdtm/static/socket-tcp-fin-wait1.c
+++ b/test/zdtm/static/socket-tcp-fin-wait1.c
@@ -141,7 +141,7 @@ int main(int argc, char **argv)
 			return 1;
 		}
 
-		if (write(fd, TEST_MSG + 2, sizeof(TEST_MSG) - 2) != sizeof(TEST_MSG) - 2) {
+		if (write(fd, &TEST_MSG[2], sizeof(TEST_MSG) - 2) != sizeof(TEST_MSG) - 2) {
 			pr_err("write");
 			return 1;
 		}
-- 
2.24.0



More information about the CRIU mailing list