[CRIU] [PATCH 3/4] iproute: Fix errno propagation to c/r
Pavel Emelyanov
xemul at parallels.com
Thu Aug 2 00:51:13 EDT 2012
Signed-off-by: Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
lib/libnetlink.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 878911e..8e8c8b9 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -360,13 +360,14 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
if (l < sizeof(struct nlmsgerr)) {
fprintf(stderr, "ERROR truncated\n");
} else {
- errno = -err->error;
- if (errno == 0) {
+ if (!err->error) {
if (answer)
memcpy(answer, h, h->nlmsg_len);
return 0;
}
- perror("RTNETLINK answers");
+
+ fprintf(stderr, "RTNETLINK answers: %s\n", strerror(-err->error));
+ errno = -err->error;
}
return -1;
}
--
1.7.1
More information about the CRIU
mailing list