summaryrefslogtreecommitdiff
path: root/daemon/main.c
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2021-03-30 10:03:28 +0200
committerOndrej Holy <oholy@redhat.com>2021-04-15 07:12:32 +0000
commit06f90d2800048c5d52cf46adc882a49fe0707bcd (patch)
tree2fce2168bda66a4923145b7f9cbd8f835eff3846 /daemon/main.c
parent4bb8a42f90e681aa07ed9942d5dafd69d0307f0a (diff)
downloadgvfs-06f90d2800048c5d52cf46adc882a49fe0707bcd.tar.gz
daemon: Create socket dir from gvfsd daemon
Recently, GVfs switched from abstract sockets to named sockets. The socket dir is currently created by the individual daemons immediately before starting DBus server. If gvfsd-admin is started at first, the socket dir is owned by root user and thus it isn't accesible for other daemons and clients. Let's create the socket dir early from the gvfsd daemon to ensure correct ownership. https://gitlab.gnome.org/GNOME/gvfs/-/issues/552
Diffstat (limited to 'daemon/main.c')
-rw-r--r--daemon/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/daemon/main.c b/daemon/main.c
index d145c5f8..ff1c522b 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -143,6 +143,7 @@ main (int argc, char *argv[])
guint name_owner_id;
GBusNameOwnerFlags flags;
GOptionContext *context;
+ gchar *socket_dir;
const GOptionEntry options[] = {
{ "replace", 'r', 0, G_OPTION_ARG_NONE, &replace, N_("Replace old daemon."), NULL },
{ "no-fuse", 0, 0, G_OPTION_ARG_NONE, &no_fuse, N_("Don’t start fuse."), NULL },
@@ -212,6 +213,11 @@ main (int argc, char *argv[])
if (daemon == NULL)
return 1;
+ /* This is needed for gvfsd-admin to ensure correct ownership. */
+ socket_dir = gvfs_get_socket_dir ();
+ g_mkdir (socket_dir, 0700);
+ g_free (socket_dir);
+
g_signal_connect (daemon, "shutdown",
G_CALLBACK (daemon_shutdown), loop);