summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-bus/test-bus-watch-bind.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 10:23:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 10:23:34 +0000
commit35962ed6b09ac995d663aeb7ab0287743cecc24c (patch)
tree24a36570c53b15b3bd6e955054f8c4846db0e262 /src/libsystemd/sd-bus/test-bus-watch-bind.c
parentAdding debian version 252.22-1~deb12u1. (diff)
downloadsystemd-35962ed6b09ac995d663aeb7ab0287743cecc24c.tar.xz
systemd-35962ed6b09ac995d663aeb7ab0287743cecc24c.zip
Merging upstream version 252.23.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/libsystemd/sd-bus/test-bus-watch-bind.c')
-rw-r--r--src/libsystemd/sd-bus/test-bus-watch-bind.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-watch-bind.c b/src/libsystemd/sd-bus/test-bus-watch-bind.c
index c577330..fae2a45 100644
--- a/src/libsystemd/sd-bus/test-bus-watch-bind.c
+++ b/src/libsystemd/sd-bus/test-bus-watch-bind.c
@@ -7,6 +7,7 @@
#include "sd-id128.h"
#include "alloc-util.h"
+#include "bus-internal.h"
#include "fd-util.h"
#include "fs-util.h"
#include "mkdir.h"
@@ -27,8 +28,11 @@ static int method_foobar(sd_bus_message *m, void *userdata, sd_bus_error *ret_er
static int method_exit(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
log_info("Got Exit() call");
- assert_se(sd_event_exit(sd_bus_get_event(sd_bus_message_get_bus(m)), 1) >= 0);
- return sd_bus_reply_method_return(m, NULL);
+
+ assert_se(sd_bus_reply_method_return(m, NULL) >= 0);
+ /* Simulate D-Bus going away to test the bus_exit_now() path with exit_on_disconnect set */
+ bus_enter_closing(sd_bus_message_get_bus(m));
+ return 0;
}
static const sd_bus_vtable vtable[] = {
@@ -100,6 +104,7 @@ static void* thread_server(void *p) {
log_debug("Accepted server connection");
assert_se(sd_bus_new(&bus) >= 0);
+ assert_se(sd_bus_set_exit_on_disconnect(bus, true) >= 0);
assert_se(sd_bus_set_description(bus, "server") >= 0);
assert_se(sd_bus_set_fd(bus, bus_fd, bus_fd) >= 0);
assert_se(sd_bus_set_server(bus, true, id) >= 0);