mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-12-08 23:03:46 +00:00
67 lines
2.3 KiB
Diff
67 lines
2.3 KiB
Diff
From 233ba5c3a0f73e01fe6149fd8c377826a83c2a0a Mon Sep 17 00:00:00 2001
|
|
From: Tom Gundersen <teg@jklm.no>
|
|
Date: Thu, 29 Jan 2015 07:26:58 +0100
|
|
Subject: [PATCH] sd-rtnl: don't fail event handler when callback fails
|
|
|
|
As in sd-bus, simply log at debug level when a callback fails, but don't fail the event handler.
|
|
Otherwise any error returned by any callback will disable the rtnl event handler. We should
|
|
only do that on serious internal errors in sd-rtnl that we know cannot be recovered from.
|
|
---
|
|
src/libsystemd/sd-rtnl/sd-rtnl.c | 20 +++++++++++++++-----
|
|
1 file changed, 15 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
|
|
index 5778ea5..7f1ec30 100644
|
|
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
|
|
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
|
|
@@ -379,9 +379,12 @@ static int process_timeout(sd_rtnl *rtnl) {
|
|
hashmap_remove(rtnl->reply_callbacks, &c->serial);
|
|
|
|
r = c->callback(rtnl, m, c->userdata);
|
|
+ if (r < 0)
|
|
+ log_debug_errno(r, "sd-rtnl: timedout callback failed: %m");
|
|
+
|
|
free(c);
|
|
|
|
- return r < 0 ? r : 1;
|
|
+ return 1;
|
|
}
|
|
|
|
static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) {
|
|
@@ -404,9 +407,12 @@ static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) {
|
|
prioq_remove(rtnl->reply_callbacks_prioq, c, &c->prioq_idx);
|
|
|
|
r = c->callback(rtnl, m, c->userdata);
|
|
+ if (r < 0)
|
|
+ log_debug_errno(r, "sd-rtnl: callback failed: %m");
|
|
+
|
|
free(c);
|
|
|
|
- return r;
|
|
+ return 1;
|
|
}
|
|
|
|
static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) {
|
|
@@ -424,12 +430,16 @@ static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) {
|
|
LIST_FOREACH(match_callbacks, c, rtnl->match_callbacks) {
|
|
if (type == c->type) {
|
|
r = c->callback(rtnl, m, c->userdata);
|
|
- if (r != 0)
|
|
- return r;
|
|
+ if (r != 0) {
|
|
+ if (r < 0)
|
|
+ log_debug_errno(r, "sd-rtnl: match callback failed: %m");
|
|
+
|
|
+ break;
|
|
+ }
|
|
}
|
|
}
|
|
|
|
- return 0;
|
|
+ return 1;
|
|
}
|
|
|
|
static int process_running(sd_rtnl *rtnl, sd_rtnl_message **ret) {
|
|
--
|
|
2.3.0
|
|
|