[CRIU] [PATCH 1/5] socket-tcp: ignore SIGPIPE

Andrei Vagin avagin at gmail.com
Tue Nov 27 20:45:41 MSK 2018


In this tests, we are trying to read from closed sockets.

Signed-off-by: Andrei Vagin <avagin at gmail.com>
---
 test/zdtm/static/socket-tcp-closed.c  | 2 ++
 test/zdtm/static/socket-tcp-reseted.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/test/zdtm/static/socket-tcp-closed.c b/test/zdtm/static/socket-tcp-closed.c
index 0447e95b2..a51f9b96d 100644
--- a/test/zdtm/static/socket-tcp-closed.c
+++ b/test/zdtm/static/socket-tcp-closed.c
@@ -23,6 +23,7 @@ const char *test_author = "Andrey Vagin <avagin at openvz.org";
 #include <signal.h>
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
+#include <signal.h>
 
 static int port = 8880;
 
@@ -43,6 +44,7 @@ int main(int argc, char **argv)
 #endif
 
 	test_init(argc, argv);
+	signal(SIGPIPE, SIG_IGN);
 
 	sk = socket(ZDTM_FAMILY, SOCK_STREAM, 0);
 	if (sk < 0) {
diff --git a/test/zdtm/static/socket-tcp-reseted.c b/test/zdtm/static/socket-tcp-reseted.c
index ce52e1148..07ad36009 100644
--- a/test/zdtm/static/socket-tcp-reseted.c
+++ b/test/zdtm/static/socket-tcp-reseted.c
@@ -5,6 +5,7 @@
 #include <arpa/inet.h>  /* for sockaddr_in and inet_ntoa() */
 #include <stdlib.h>
 #include <sys/wait.h>
+#include <signal.h>
 
 #ifdef ZDTM_IPV4V6
 #define ZDTM_FAMILY AF_INET
@@ -38,6 +39,7 @@ int main(int argc, char **argv)
 	char cmd[4096], buf[10];
 
 	test_init(argc, argv);
+	signal(SIGPIPE, SIG_IGN);
 
 	if ((fd_s = tcp_init_server(ZDTM_SRV_FAMILY, &port)) < 0) {
 		pr_err("initializing server failed\n");
-- 
2.14.4



More information about the CRIU mailing list