summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-10-30 16:37:42 +0100
committerLennart Poettering <lennart@poettering.net>2019-10-30 17:43:57 +0100
commitf59825595182d70b9ead238d1e885d0db99cc201 (patch)
tree70147f1468158bb6bc79226ea9cf42f79405839b
parentb7db8b7b139fa6cfb6516197d5ac8d10360ac57a (diff)
downloadsystemd-f59825595182d70b9ead238d1e885d0db99cc201.tar.gz
sd-event: don't invalidate source type on disconnect
This fixes fd closing if fd ownership is requested.
-rw-r--r--src/libsystemd/sd-event/sd-event.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index ee10728ece..d93d2f4046 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -771,11 +771,13 @@ static void source_disconnect(sd_event_source *s) {
event = s->event;
- s->type = _SOURCE_EVENT_SOURCE_TYPE_INVALID;
s->event = NULL;
LIST_REMOVE(sources, event->sources, s);
event->n_sources--;
+ /* Note that we don't invalidate the type here, since we still need it in order to close the fd or
+ * pidfd associated with this event source, which we'll do only on source_free(). */
+
if (!s->floating)
sd_event_unref(event);
}