aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glib-2.0/glib-2.0/allow-run-media-sdX-drive-mount-if-username-root.patch
blob: 3040479422459ceccc4c78f6329566241d300b83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 66e5fd5e870a2de04ec0f0c5dbfa23db496bad43 Mon Sep 17 00:00:00 2001
From: Marius Avram <marius.avram@intel.com>
Date: Wed, 27 Aug 2014 12:10:41 +0300
Subject: [PATCH] Allow /run/media/sdX drive mount if username root

In case that the username logged in the system is root
the drives are directly mounted in /run/media/sdX and
not /run/media/<username>/sdX as the function
g_unix_mount_guess_should_display() expects.

Without this change USB stick mounts are not accesible from
graphical applications such as the File Manager (pcmanfm).

Upstream-Status: Inappropriate

Signed-off-by: Marius Avram <marius.avram@intel.com>

---
 gio/gunixmounts.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index 355329c..6467fc5 100644
--- a/gio/gunixmounts.c
+++ b/gio/gunixmounts.c
@@ -2745,6 +2745,11 @@ g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry)
             is_in_runtime_dir = TRUE;
         }
 
+      /* Allow no username in path in /run/media if current user is root */
+      if (strcmp(user_name, "root") == 0 &&
+          strncmp (mount_path, "/run/media/", sizeof("run/media")) == 0)
+        is_in_runtime_dir = TRUE;
+
       if (is_in_runtime_dir || g_str_has_prefix (mount_path, "/media/"))
         {
           char *path;