From 13974315ad3a16c3694a41ad7bcb0c453cc8774e Mon Sep 17 00:00:00 2001 From: "Tate, Hongliang Tian" Date: Sat, 6 Jul 2019 07:58:47 +0000 Subject: [PATCH] Fix all compiler warnings for tests --- test/client/main.c | 5 +++-- test/pipe/main.c | 2 +- test/server/main.c | 3 ++- test/server_epoll/main.c | 1 + test/unix_socket/main.c | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/test/client/main.c b/test/client/main.c index 558aa580..d73dfb94 100644 --- a/test/client/main.c +++ b/test/client/main.c @@ -5,10 +5,11 @@ #include #include #include +#include #include +#include int main(int argc, const char *argv[]) { - const int BUF_SIZE = 0x1000; const char* message = "Hello world!"; int ret; @@ -49,4 +50,4 @@ int main(int argc, const char *argv[]) { close(sockfd); return 0; -} \ No newline at end of file +} diff --git a/test/pipe/main.c b/test/pipe/main.c index b1d10271..9d2914fe 100644 --- a/test/pipe/main.c +++ b/test/pipe/main.c @@ -29,7 +29,7 @@ int main(int argc, const char* argv[]) { const char* child_argv[3] = { child_prog, msg, NULL }; int child_pid; if (posix_spawn(&child_pid, child_prog, &file_actions, - NULL, child_argv, NULL) < 0) { + NULL, (char*const *)child_argv, NULL) < 0) { printf("ERROR: failed to spawn a child process\n"); return -1; } diff --git a/test/server/main.c b/test/server/main.c index 27094499..3e67dae4 100644 --- a/test/server/main.c +++ b/test/server/main.c @@ -6,6 +6,7 @@ #include #include #include +#include int main(int argc, const char *argv[]) { const int BUF_SIZE = 0x1000; @@ -56,4 +57,4 @@ int main(int argc, const char *argv[]) { close(connect_fd); close(listenfd); -} \ No newline at end of file +} diff --git a/test/server_epoll/main.c b/test/server_epoll/main.c index 22f8867c..93055f0a 100644 --- a/test/server_epoll/main.c +++ b/test/server_epoll/main.c @@ -9,6 +9,7 @@ #include #include #include +#include #define MAXEVENTS 64 diff --git a/test/unix_socket/main.c b/test/unix_socket/main.c index 9d32cdd1..a78cc086 100644 --- a/test/unix_socket/main.c +++ b/test/unix_socket/main.c @@ -7,6 +7,7 @@ #include #include #include +#include const char SOCK_PATH[] = "echo_socket"; @@ -86,7 +87,7 @@ int main(int argc, const char* argv[]) { const char* child_argv[3] = { child_prog, msg, NULL }; int child_pid; if (posix_spawn(&child_pid, child_prog, &file_actions, - NULL, child_argv, NULL) < 0) { + NULL, (char*const*)child_argv, NULL) < 0) { printf("ERROR: failed to spawn a child process\n"); return -1; }