[gvfs/wip/oholy/admin-hang: 2/2] admin: Fix mount operation hang caused by pkexec failure
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/oholy/admin-hang: 2/2] admin: Fix mount operation hang caused by pkexec failure
- Date: Wed, 12 May 2021 08:50:17 +0000 (UTC)
commit 0a3eb531d98b28dbe5b0f6c2a551a61cc8a2fce3
Author: Ondrej Holy <oholy redhat com>
Date: Wed May 12 10:29:14 2021 +0200
admin: Fix mount operation hang caused by pkexec failure
Currently, the mount operation for the admin backend can hang when the
authentication dialog is dismissed for example. This is because `pkexec`
exits before spawning the `gvfsd-admin` daemon. Let's catch that case
and return the "Permission denied" error.
Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/565
daemon/mount.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/daemon/mount.c b/daemon/mount.c
index 33cae597..34b28b6b 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -415,6 +415,21 @@ child_watch_cb (GPid pid,
gint status,
gpointer user_data)
{
+ MountData *data = user_data;
+ GError *error;
+
+ /* GVfs daemons always exit with 0, but gvfsd-admin is spawned over pkexec,
+ * which can fail when the authentication dialog is dismissed for example.
+ */
+ if (status == 126 || status == 127)
+ {
+ error = g_error_new_literal (G_IO_ERROR,
+ G_IO_ERROR_PERMISSION_DENIED,
+ _("Permission denied"));
+ mount_finish (data, error);
+ g_error_free (error);
+ }
+
g_spawn_close_pid (pid);
}
@@ -485,7 +500,7 @@ spawn_mount (MountData *data)
}
else
{
- g_child_watch_add (pid, child_watch_cb, NULL);
+ g_child_watch_add (pid, child_watch_cb, data);
}
g_strfreev (argv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]