[CRIU] [PATCH] zdtm: Pick up deleted unix socket test

Pavel Emelyanov xemul at parallels.com
Thu Jul 3 07:34:39 PDT 2014


CRIU doesn't support relative unix sockets paths, so
tune the test to use absolute.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 test/zdtm.sh                              | 1 +
 test/zdtm/live/static/deleted_unix_sock.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index 5ed405c..3e1f289 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -57,6 +57,7 @@ static/sock_opts01
 static/sockets_spair
 static/sockets_dgram
 static/socket_queues
+static/deleted_unix_sock
 static/sk-unix-unconn
 static/pid00
 static/pstree
diff --git a/test/zdtm/live/static/deleted_unix_sock.c b/test/zdtm/live/static/deleted_unix_sock.c
index 79636ef..acf938d 100644
--- a/test/zdtm/live/static/deleted_unix_sock.c
+++ b/test/zdtm/live/static/deleted_unix_sock.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <errno.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -19,11 +20,14 @@ TEST_OPTION(filename, string, "file name", 1);
 
 static int fill_sock_name(struct sockaddr_un *name, const char *filename)
 {
-	if (strlen(filename) >= sizeof(name->sun_path))
+	char *cwd;
+
+	cwd = get_current_dir_name();
+	if (strlen(filename) + strlen(cwd) >= sizeof(name->sun_path))
 		return -1;
 
 	name->sun_family = AF_LOCAL;
-	strcpy(name->sun_path, filename);
+	sprintf(name->sun_path, "%s/%s", cwd, filename);
 	return 0;
 }
 
-- 
1.8.4.2



More information about the CRIU mailing list