#include <errno.h>
#include <sys/socket.h>
+#include "bus-internal.h"
+#include "bus-kernel.h"
#include "sd-bus.h"
#include "macro.h"
/* This means b's name disappeared. Let's now disconnect, to make sure the track handling on disconnect works
* as it should. */
- assert_se(shutdown(sd_bus_get_fd(sd_bus_track_get_bus(t)), SHUT_RDWR) >= 0);
+ if (sd_bus_track_get_bus(t)->is_kernel)
+ assert_se(bus_kernel_try_close(sd_bus_track_get_bus(t)) >= 0);
+ else
+ assert_se(shutdown(sd_bus_get_fd(sd_bus_track_get_bus(t)), SHUT_RDWR) >= 0);
return 1;
}
assert_se(r >= 0);
/* Now make b's name disappear */
- sd_bus_close(b);
+ if (b->is_kernel) {
+ r = sd_bus_try_close(b);
+ if (r < 0) {
+ log_error("Cannot close kdbus, skipping the test");
+ return EXIT_TEST_SKIP;
+ }
+ } else
+ sd_bus_close(b);
r = sd_event_loop(event);
assert_se(r >= 0);