From 51197aac23384bb81cc183d9bf27c7021c40d887 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 7 Nov 2025 13:32:27 -0500 Subject: [PATCH] btio: Fix endless loop if accept return -EBADFD In certain cases, e.g. ISO Broadcast Listen, the listening socket may get into an invalid state (CONNECTED) if the PA Sync is terminated causing an endless loop of accept syscall. --- btio/btio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/btio/btio.c b/btio/btio.c index 1a34927b2..cfaa9392d 100644 --- a/btio/btio.c +++ b/btio/btio.c @@ -253,8 +253,11 @@ static gboolean server_cb(GIOChannel *io, GIOCondition cond, srv_sock = g_io_channel_unix_get_fd(io); cli_sock = accept(srv_sock, NULL, NULL); - if (cli_sock < 0) + if (cli_sock < 0) { + if (errno == EBADFD) + return FALSE; return TRUE; + } cli_io = g_io_channel_unix_new(cli_sock); -- 2.47.3