mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 05:48:05 +00:00
criu/lazy-pages: fix socket creation with relative images-dir
The UNIX sockets do not like relative paths. Assuming both lazy-pages daemon and restore use the same opts.work_dir, their working directory full path will be the same. Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
0f60684b8f
commit
a405d25b60
10
criu/uffd.c
10
criu/uffd.c
@ -119,16 +119,22 @@ 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", opts.work_dir, LAZY_PAGES_SOCK_NAME);
|
||||
"%s/%s", cwd, LAZY_PAGES_SOCK_NAME);
|
||||
if (len >= sizeof(saddr->sun_path)) {
|
||||
pr_err("Wrong UNIX socket name: %s/%s\n",
|
||||
opts.work_dir, LAZY_PAGES_SOCK_NAME);
|
||||
cwd, LAZY_PAGES_SOCK_NAME);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user