[CRIU] [PATCH] test/rpc: include unistd.h

Andrew Vagin avagin at openvz.org
Mon Aug 10 04:37:14 PDT 2015


gcc -c test.c -I ./
test.c: In function ‘recv_resp’:
test.c:18:8: warning: implicit declaration of function ‘read’ [-Wimplicit-function-declaration]
  len = read(socket_fd, buf, MAX_MSG_SIZE);
        ^
test.c: In function ‘send_req’:
test.c:45:6: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  if (write(socket_fd, buf, len)  == -1) {
      ^
test.c: In function ‘main’:
test.c:165:2: warning: implicit declaration of function ‘close’ [-Wimplicit-function-declaration]
  close(fd);

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 test/rpc/Makefile | 4 ++--
 test/rpc/test.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/rpc/Makefile b/test/rpc/Makefile
index 46f36a8..a3a539f 100644
--- a/test/rpc/Makefile
+++ b/test/rpc/Makefile
@@ -1,6 +1,8 @@
 all: test-c rpc_pb2.py criu
 .PHONY: all
 
+CFLAGS += -g -Werror -Wall
+
 run: all
 	mkdir -p build
 	chmod a+rwx build
@@ -11,10 +13,8 @@ criu:
 	chmod u+s $@
 
 test-c: rpc.pb-c.o test.o
-	gcc $^ -o $@ -lprotobuf-c
 
 test.o: test.c
-	gcc -c $< -I ./
 
 rpc_pb2.py: rpc.proto
 	protoc --proto_path=. --python_out=. rpc.proto
diff --git a/test/rpc/test.c b/test/rpc/test.c
index 26e0bb6..9ef5778 100644
--- a/test/rpc/test.c
+++ b/test/rpc/test.c
@@ -6,6 +6,7 @@
 #include <sys/fcntl.h>
 #include <stdio.h>
 #include <dirent.h>
+#include <unistd.h>
 
 #define MAX_MSG_SIZE 1024
 
@@ -58,7 +59,6 @@ int main(int argc, char *argv[])
 	int ret = 0;
 	struct sockaddr_un addr;
 	socklen_t addr_len;
-	struct stat st = {0};
 
 	if (argc != 3) {
 		fprintf(stderr, "Usage: test-c criu-service.socket imgs_dir");
-- 
2.4.3



More information about the CRIU mailing list