From 6a3e5c2ae81540ec55ec4e642b50e8db5293c0f6 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Sat, 13 May 2023 20:33:35 +0200 Subject: [PATCH] Fixed abort when running in foreground but stdin is closed A forgotten else-clause caused BIRD to treat some pseudo-random place in memory as fd-pair. This was happening only on startup of the first thread in group and the value there in memory was typically zero ... and writing to stdin succeeded. When running BIRD with stdin not present (like systemd does), it died on this spurious write. Now it seems to work correctly. Thanks to Daniel Suchy for reporting. http://trubka.network.cz/pipermail/bird-users/2023-May/016929.html --- sysdep/unix/io-loop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sysdep/unix/io-loop.c b/sysdep/unix/io-loop.c index a3b54394..58e296a6 100644 --- a/sysdep/unix/io-loop.c +++ b/sysdep/unix/io-loop.c @@ -1536,7 +1536,8 @@ birdloop_vnew_internal(pool *pp, uint order, struct birdloop_pickup_group *group add_tail(&group->loops, &loop->n); if (EMPTY_LIST(group->threads)) ev_send(&global_event_list, &group->start_threads); - wakeup_do_kick(SKIP_BACK(struct bird_thread, n, HEAD(group->threads))); + else + wakeup_do_kick(SKIP_BACK(struct bird_thread, n, HEAD(group->threads))); UNLOCK_DOMAIN(attrs, group->domain); } else