From a1d045bb9cb781b64033be8d593a0d16d7df5053 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 18 May 2023 17:05:41 +0200
Subject: [PATCH] sd-bus,sd-event: allow querying of description even after
 fork

This in unnecessarilly unpleasant: the code might report about a bus
connection, e.g. in an error message or assert. Let's let it query
the name of the object.

This partially reverts f4b2933ee7890e5d414ab266d8586f19027a2bd9.

(cherry picked from commit ed7a6f51eab5af40d3d7884ce846f74aea0c00f0)
(cherry picked from commit a3e5eb5606d92b5c4db9306cbd3fcac56e9ff10a)
(cherry picked from commit 299573b5d7eeec6b25e07cf6ec12b2ffef151f85)

Conflict:code context adaptation
Reference:https://github.com/systemd/systemd-stable/commit/a1d045bb9cb781b64033be8d593a0d16d7df5053
---
 src/libsystemd/sd-bus/sd-bus.c     | 1 -
 src/libsystemd/sd-event/sd-event.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index dae85becc2..c53686f6b0 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -4162,7 +4162,6 @@ _public_ int sd_bus_get_description(sd_bus *bus, const char **description) {
         assert_return(bus = bus_resolve(bus), -ENOPKG);
         assert_return(description, -EINVAL);
         assert_return(bus->description, -ENXIO);
-        assert_return(!bus_pid_changed(bus), -ECHILD);
 
         if (bus->description)
                 *description = bus->description;
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index 00bf6ac1e5..95102921a5 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -2162,7 +2162,6 @@ _public_ int sd_event_source_set_description(sd_event_source *s, const char *des
 _public_ int sd_event_source_get_description(sd_event_source *s, const char **description) {
         assert_return(s, -EINVAL);
         assert_return(description, -EINVAL);
-        assert_return(!event_pid_changed(s->event), -ECHILD);
 
         if (!s->description)
                 return -ENXIO;
-- 
2.33.0

