15 Star 11 Fork 109

src-openEuler/systemd
Closed

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
backport-sd-bus-fix-use-of-ERRNO_IS_DISCONNECT.patch 1.85 KB
Copy Edit Raw Blame History
胡宇彪 authored 2023-12-18 16:44 +08:00 . sync patches from systemd community
From d4d356c6c2ed5ea0b15c6fd49a29badb022c217e Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Fri, 7 Jul 2023 08:00:00 +0000
Subject: [PATCH] sd-bus: fix use of ERRNO_IS_DISCONNECT()
Given that ERRNO_IS_DISCONNECT() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.
In this case the argument passed to ERRNO_IS_DISCONNECT() is the value
returned by bus_socket_process_watch_bind(), bus_socket_process_opening(),
and bus_socket_process_authenticating() which can legitimately return
positive values without errno semantics, so fix this by moving the
ERRNO_IS_DISCONNECT() invocation to the branch where the return value
is known to be negative.
(cherry picked from commit bb228f0ebc9b691ee2a871bffbf949936568f3ea)
(cherry picked from commit 920568b7e213162babcbe0c0cdd4e2fe28882ebd)
Conflict:code context adaptation
Reference:https://github.com/systemd/systemd-stable/commit/d4d356c6c2ed5ea0b15c6fd49a29badb022c217e
---
src/libsystemd/sd-bus/sd-bus.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index d6a3177d39..d2c68688ad 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -3236,11 +3236,13 @@ static int bus_process_internal(sd_bus *bus, sd_bus_message **ret) {
assert_not_reached("Unknown state");
}
- if (ERRNO_IS_DISCONNECT(r)) {
- bus_enter_closing(bus);
- r = 1;
- } else if (r < 0)
- return r;
+ if (r < 0) {
+ if (ERRNO_IS_DISCONNECT(r)) {
+ bus_enter_closing(bus);
+ r = 1;
+ } else
+ return r;
+ }
if (ret)
*ret = NULL;
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/systemd.git
git@gitee.com:src-openeuler/systemd.git
src-openeuler
systemd
systemd
3b23f9ffafa40dc89ef6591685566269cb9a88ee

Search