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/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <spawn.h>
#include <unistd.h>
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;
}
}

@ -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;
}

@ -6,6 +6,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <spawn.h>
#include <unistd.h>
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);
}
}

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

@ -7,6 +7,7 @@
#include <stdio.h>
#include <spawn.h>
#include <string.h>
#include <spawn.h>
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;
}