From 1929fd1cc60edcd04baaf54b1821d9d7b4b5f4ba Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 11 Jan 2018 20:32:38 -0800 Subject: [PATCH] utils: clear GUnixFDList before entering main loop If we do not clear the FDList before entering the main loop, the splice async command may not complete because the pipe fd is still held. This fixes an issue where builder_maybe_host_spawnv() hangs indefinitely when run inside a Flatpak application. Closes: #100 Approved by: alexlarsson --- src/builder-utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/builder-utils.c b/src/builder-utils.c index ecd8c5a8..68874de7 100644 --- a/src/builder-utils.c +++ b/src/builder-utils.c @@ -1575,6 +1575,11 @@ builder_host_spawnv (GFile *dir, g_variant_get (ret, "(u)", &client_pid); data.client_pid = client_pid; + /* Drop the FDList immediately or splice_async() may not + * complete when the peer process exists, causing us to hang. + */ + g_clear_object (&fd_list); + g_main_loop_run (loop); g_source_remove (sigterm_id);