Skip to content
Snippets Groups Projects
Commit 7fac9ccb authored by Simon McVittie's avatar Simon McVittie
Browse files

pv-wrap: Use g_fdwalk_set_cloexec() instead of flatpak_close_fds_workaround()

This is essentially a backport of the change proposed in
<https://github.com/flatpak/flatpak/pull/5687

>.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 9b397fec
Branches
Tags
1 merge request!671Use libglnx g_fdwalk_set_cloexec() backport
...@@ -507,7 +507,13 @@ flatpak_bwrap_child_setup (GArray *fd_array, ...@@ -507,7 +507,13 @@ flatpak_bwrap_child_setup (GArray *fd_array,
int i; int i;
if (close_fd_workaround) if (close_fd_workaround)
#if 0
flatpak_close_fds_workaround (3); flatpak_close_fds_workaround (3);
#else
/* pressure-vessel-specific change for now, but see
* https://github.com/flatpak/flatpak/pull/5687 */
g_fdwalk_set_cloexec (3);
#endif
/* If no fd_array was specified, don't care. */ /* If no fd_array was specified, don't care. */
if (fd_array == NULL) if (fd_array == NULL)
......
...@@ -120,6 +120,7 @@ flatpak_canonicalize_filename (const char *path) ...@@ -120,6 +120,7 @@ flatpak_canonicalize_filename (const char *path)
return g_file_get_path (file); return g_file_get_path (file);
} }
#if 0
/* There is a dead-lock in glib versions before 2.60 when it closes /* There is a dead-lock in glib versions before 2.60 when it closes
* the fds. See: https://gitlab.gnome.org/GNOME/glib/merge_requests/490 * the fds. See: https://gitlab.gnome.org/GNOME/glib/merge_requests/490
* This was hitting the test-suite a lot, so we work around it by using * This was hitting the test-suite a lot, so we work around it by using
...@@ -135,3 +136,4 @@ flatpak_close_fds_workaround (int start_fd) ...@@ -135,3 +136,4 @@ flatpak_close_fds_workaround (int start_fd)
for (fd = start_fd; fd < max_open_fds; fd++) for (fd = start_fd; fd < max_open_fds; fd++)
fcntl (fd, F_SETFD, FD_CLOEXEC); fcntl (fd, F_SETFD, FD_CLOEXEC);
} }
#endif
...@@ -98,8 +98,8 @@ test_bwrap_executable (const char *bwrap_executable, ...@@ -98,8 +98,8 @@ test_bwrap_executable (const char *bwrap_executable,
g_ptr_array_add (argv, (char *) "true"); g_ptr_array_add (argv, (char *) "true");
g_ptr_array_add (argv, NULL); g_ptr_array_add (argv, NULL);
/* We use LEAVE_DESCRIPTORS_OPEN to work around a deadlock in older GLib, /* We use LEAVE_DESCRIPTORS_OPEN and set CLOEXEC in the child_setup,
* see flatpak_close_fds_workaround */ * to work around a deadlock in GLib < 2.60 */
if (!g_spawn_sync (NULL, /* cwd */ if (!g_spawn_sync (NULL, /* cwd */
(gchar **) argv->pdata, (gchar **) argv->pdata,
NULL, /* environ */ NULL, /* environ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment