Fix all compiler warnings for tests

This commit is contained in:
Tate, Hongliang Tian 2019-07-06 07:58:47 +00:00
parent a579f84e90
commit 13974315ad
5 changed files with 9 additions and 5 deletions

@ -5,10 +5,11 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h>
#include <spawn.h> #include <spawn.h>
#include <unistd.h>
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
const int BUF_SIZE = 0x1000;
const char* message = "Hello world!"; const char* message = "Hello world!";
int ret; int ret;

@ -29,7 +29,7 @@ int main(int argc, const char* argv[]) {
const char* child_argv[3] = { child_prog, msg, NULL }; const char* child_argv[3] = { child_prog, msg, NULL };
int child_pid; int child_pid;
if (posix_spawn(&child_pid, child_prog, &file_actions, 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"); printf("ERROR: failed to spawn a child process\n");
return -1; return -1;
} }

@ -6,6 +6,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <spawn.h> #include <spawn.h>
#include <unistd.h>
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
const int BUF_SIZE = 0x1000; const int BUF_SIZE = 0x1000;

@ -9,6 +9,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/epoll.h> #include <sys/epoll.h>
#include <errno.h> #include <errno.h>
#include <spawn.h>
#define MAXEVENTS 64 #define MAXEVENTS 64

@ -7,6 +7,7 @@
#include <stdio.h> #include <stdio.h>
#include <spawn.h> #include <spawn.h>
#include <string.h> #include <string.h>
#include <spawn.h>
const char SOCK_PATH[] = "echo_socket"; 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 }; const char* child_argv[3] = { child_prog, msg, NULL };
int child_pid; int child_pid;
if (posix_spawn(&child_pid, child_prog, &file_actions, 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"); printf("ERROR: failed to spawn a child process\n");
return -1; return -1;
} }