[CRIU] [PATCH v4] lazy-pages: use relative path for UNIX socket

Mike Rapoport rppt at linux.vnet.ibm.com
Fri Nov 4 13:02:36 PDT 2016


Use relative path for UNIX socket instead of absolute one.
This ensures we won't run into problems with invalid socket names.

Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
v4: use relative path rather than abstract socket

 criu/uffd.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/criu/uffd.c b/criu/uffd.c
index e6d4069..e9ba4ae 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -125,22 +125,15 @@ static void lpi_hash_fini(void)
 
 static int prepare_sock_addr(struct sockaddr_un *saddr)
 {
-	char cwd[PATH_MAX];
 	int len;
 
-	if (!getcwd(cwd, PATH_MAX)) {
-		pr_perror("Cannot get CWD\n");
-		return -1;
-	}
-
 	memset(saddr, 0, sizeof(struct sockaddr_un));
 
 	saddr->sun_family = AF_UNIX;
 	len = snprintf(saddr->sun_path, sizeof(saddr->sun_path),
-		       "%s/%s", cwd, LAZY_PAGES_SOCK_NAME);
+		       "%s", LAZY_PAGES_SOCK_NAME);
 	if (len >= sizeof(saddr->sun_path)) {
-		pr_err("Wrong UNIX socket name: %s/%s\n",
-		       cwd, LAZY_PAGES_SOCK_NAME);
+		pr_err("Wrong UNIX socket name: %s\n", LAZY_PAGES_SOCK_NAME);
 		return -1;
 	}
 
-- 
1.9.1



More information about the CRIU mailing list