2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00

socket: skip unsupported sockets

Before this patch, it stopped if stat() failed.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2012-07-17 11:50:00 +04:00 committed by Pavel Emelyanov
parent 64967eef21
commit bed6c34b17

View File

@ -234,6 +234,8 @@ static int unix_collect_one(const struct unix_diag_msg *m,
struct rtattr **tb)
{
struct unix_sk_desc *d;
char *name = NULL;
int ret = 0;
d = xzalloc(sizeof(*d));
if (!d)
@ -248,8 +250,8 @@ static int unix_collect_one(const struct unix_diag_msg *m,
if (tb[UNIX_DIAG_NAME]) {
int len = RTA_PAYLOAD(tb[UNIX_DIAG_NAME]);
char *name = xmalloc(len + 1);
name = xmalloc(len + 1);
if (!name)
goto err;
@ -263,22 +265,20 @@ static int unix_collect_one(const struct unix_diag_msg *m,
if (name[0] != '/') {
pr_warn("Relative bind path '%s' "
"unsupported\n", name);
xfree(name);
xfree(d);
return 0;
goto skip;
}
if (!tb[UNIX_DIAG_VFS]) {
pr_err("Bound socket w/o inode %d\n",
m->udiag_ino);
goto err;
goto skip;
}
uv = RTA_DATA(tb[UNIX_DIAG_VFS]);
if (stat(name, &st)) {
pr_perror("Can't stat socket %d(%s)",
m->udiag_ino, name);
goto err;
goto skip;
}
if ((st.st_ino != uv->udiag_vfs_ino) ||
@ -354,12 +354,13 @@ static int unix_collect_one(const struct unix_diag_msg *m,
show_one_unix("Collected", d);
return 0;
err:
ret = -1;
skip:
xfree(d->icons);
xfree(d->name);
xfree(name);
xfree(d);
return -1;
return ret;
}
int unix_receive_one(struct nlmsghdr *h)