[CRIU] [PATCH 2/3] socket: don't fail if DIAG_SHUTDOWN is absent
Andrey Vagin
avagin at openvz.org
Thu Nov 29 07:43:38 EST 2012
A error message is printed.
We want to save ability to try crtools on non C/R kernel.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
sk-inet.c | 11 +++++------
sk-unix.c | 10 ++++------
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/sk-inet.c b/sk-inet.c
index f425704..19a413b 100644
--- a/sk-inet.c
+++ b/sk-inet.c
@@ -345,11 +345,6 @@ int inet_collect_one(struct nlmsghdr *h, int family, int type, int proto)
parse_rtattr(tb, INET_DIAG_MAX, (struct rtattr *)(m + 1),
h->nlmsg_len - NLMSG_LENGTH(sizeof(*m)));
- if (!tb[INET_DIAG_SHUTDOWN]) {
- pr_err("Can't check shutdown state of inet socket\n");
- return -1;
- }
-
d = xzalloc(sizeof(*d));
if (!d)
return -1;
@@ -363,7 +358,11 @@ int inet_collect_one(struct nlmsghdr *h, int family, int type, int proto)
d->wqlen = m->idiag_wqueue;
memcpy(d->src_addr, m->id.idiag_src, sizeof(u32) * 4);
memcpy(d->dst_addr, m->id.idiag_dst, sizeof(u32) * 4);
- d->shutdown = *(u8 *)RTA_DATA(tb[INET_DIAG_SHUTDOWN]);
+
+ if (tb[INET_DIAG_SHUTDOWN])
+ d->shutdown = *(u8 *)RTA_DATA(tb[INET_DIAG_SHUTDOWN]);
+ else
+ pr_err_once("Can't check shutdown state of inet socket\n");
ret = sk_collect_one(m->idiag_inode, family, &d->sd);
diff --git a/sk-unix.c b/sk-unix.c
index 9fea468..b2081fb 100644
--- a/sk-unix.c
+++ b/sk-unix.c
@@ -262,12 +262,10 @@ static int unix_collect_one(const struct unix_diag_msg *m,
d->state = m->udiag_state;
INIT_LIST_HEAD(&d->list);
- if (!tb[UNIX_DIAG_SHUTDOWN]) {
- pr_err("No socket shutdown info\n");
- goto err;
- }
-
- d->shutdown = *(u8 *)RTA_DATA(tb[UNIX_DIAG_SHUTDOWN]);
+ if (tb[UNIX_DIAG_SHUTDOWN])
+ d->shutdown = *(u8 *)RTA_DATA(tb[UNIX_DIAG_SHUTDOWN]);
+ else
+ pr_err_once("No socket shutdown info\n");
if (tb[UNIX_DIAG_PEER])
d->peer_ino = *(int *)RTA_DATA(tb[UNIX_DIAG_PEER]);
--
1.7.11.7
More information about the CRIU
mailing list