From 6f71a35c4cfa3fd600addd0c1eedcd7eba195c2e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 1 Feb 2025 15:04:21 +0100 Subject: rtnl: properly handle runtime exceptions in listener callback Avoid re-invoking any event listener callbacks after an invocation triggered an exception in order to avoid accidentially clearing the exception information. Signed-off-by: Jo-Philipp Wich --- lib/rtnl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/rtnl.c') diff --git a/lib/rtnl.c b/lib/rtnl.c index 6d2c819..f11a653 100644 --- a/lib/rtnl.c +++ b/lib/rtnl.c @@ -3612,6 +3612,10 @@ cb_listener_event(struct nl_msg *msg, void *arg) if (uc_vm_call(vm, true, 1) != EXCEPTION_NONE) { uloop_end(); + set_error(NLE_FAILURE, "Runtime exception in callback"); + + errno = EINVAL; + return NL_STOP; } @@ -3631,12 +3635,8 @@ uc_nl_listener_cb(struct uloop_fd *fd, unsigned int events) nl_recvmsgs_default(nl_conn.evsock); - if (errno != 0) { - if (errno != EAGAIN && errno != EWOULDBLOCK) - set_error(errno, NULL); - + if (errno != 0) break; - } } } -- cgit v1.2.3