[CRIU] [PATCH 1/2] net: libnetlink -- Call error handler instead of unconditional error message

Cyrill Gorcunov gorcunov at gmail.com
Tue Oct 9 16:49:18 MSK 2018


To be able to zap error messages when needed. Without error
handler we will continue printing error. This will placate
diag modules probing since they are not mandatory features.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 criu/libnetlink.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/criu/libnetlink.c b/criu/libnetlink.c
index c713d907ef4d..2ce4a38262d4 100644
--- a/criu/libnetlink.c
+++ b/criu/libnetlink.c
@@ -21,10 +21,8 @@ static int nlmsg_receive(char *buf, int len,
 			continue;
 		if (hdr->nlmsg_type == NLMSG_DONE) {
 			int *len = (int *)NLMSG_DATA(hdr);
-
 			if (*len < 0)
-				return *len;
-
+				return err_cb(*len, arg);
 			return 0;
 		}
 		if (hdr->nlmsg_type == NLMSG_ERROR) {
@@ -49,7 +47,8 @@ static int nlmsg_receive(char *buf, int len,
 
 static int rtnl_return_err(int err, void *arg)
 {
-	pr_warn("ERROR %d reported by netlink\n", err);
+	errno = -err;
+	pr_perror("ERROR %d reported by netlink", err);
 	return err;
 }
 
-- 
2.17.1



More information about the CRIU mailing list