]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-varlink: fix bug when enqueuing messages with fds asynchronously
authorLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2024 12:13:41 +0000 (13:13 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 26 Nov 2024 16:06:53 +0000 (16:06 +0000)
When determining the poll events to wait for we need to take the queue
of pending messages that carry fds into account. Otherwise we might end
up not waking up if such an fd-carrying message is enqueued
asynchronously (i.e. not from a dispatch callback).

src/libsystemd/sd-varlink/sd-varlink.c

index c7a8a504f239d2665fcbdf665496726cb41323fa..150ce4eddabc8f68cf794a60e34a41bf7dd2eb9d 100644 (file)
@@ -1698,7 +1698,8 @@ _public_ int sd_varlink_get_events(sd_varlink *v) {
                 ret |= EPOLLIN;
 
         if (!v->write_disconnected &&
-            v->output_buffer_size > 0)
+            (v->output_queue ||
+             v->output_buffer_size > 0))
                 ret |= EPOLLOUT;
 
         return ret;