Skip to content

Instantly share code, notes, and snippets.

@wjt
Created January 16, 2019 12:28
Show Gist options
  • Select an option

  • Save wjt/7d90265ce491ea65ee698c1553f96218 to your computer and use it in GitHub Desktop.

Select an option

Save wjt/7d90265ce491ea65ee698c1553f96218 to your computer and use it in GitHub Desktop.
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index 0c248532..b4923bb6 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -7849,7 +7849,6 @@ flatpak_dir_install (FlatpakDir *self,
}
else
{
- g_autofree gchar *arg_socket = NULL;
g_autoptr (GError) local_error = NULL;
g_autoptr (GSubprocess) revokefs_fuse = NULL;
gint exit_status = -1;
@@ -7866,12 +7865,11 @@ flatpak_dir_install (FlatpakDir *self,
flatpak_dir_system_helper_call_get_revokefs_fd (self, 0, installation ? installation : "",
&socket, cancellable, error);
g_print ("Got FD from system helper: %d\n", socket);
- fcntl (socket, F_SETFD, 0);
-
- arg_socket = g_strdup_printf ("--socket=%d", socket);
- revokefs_fuse = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE,
+ g_autoptr(GSubprocessLauncher) launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
+ g_subprocess_launcher_take_fd (launcher, socket, 3 /* first available FD after stdin, stdout, stderr */);
+ revokefs_fuse = g_subprocess_launcher_spawn (launcher,
&local_error,
- "./revokefs-fuse", "-o", "uid=1000,gid=1000", arg_socket,
+ "./revokefs-fuse", "-o", "uid=1000,gid=1000", "--socket=3",
"/var/tmp/src", "/var/tmp/mnt", NULL);
if (local_error != NULL)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment