]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: don't invalidate source type on disconnect 13884/head
authorLennart Poettering <lennart@poettering.net>
Wed, 30 Oct 2019 15:37:42 +0000 (16:37 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 30 Oct 2019 16:43:57 +0000 (17:43 +0100)
This fixes fd closing if fd ownership is requested.

src/libsystemd/sd-event/sd-event.c

index ee10728ece26370bd918714c39c20b42178fb823..d93d2f40469d5dce512361f0182c7ee4491bc580 100644 (file)
@@ -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);
 }