From bd9e266e116cd39bb5c674eeb74eb55449793e7f Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Tue, 27 Sep 2016 10:32:04 +0200 Subject: [PATCH] gunixmounts: Fix /proc/self/mountinfo monitoring /proc/self/mountinfo is used to monitor changes of mounts with libmount. However, GFileMonitor is used currently to monitor this file, which doesn't work and consequently "changed" signal is never emitted. Special monitoring needs to be used instead, same as it is used for /proc/mounts. https://bugzilla.gnome.org/show_bug.cgi?id=662946 --- gio/gunixmounts.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c index f87ba5d14..b5e066f84 100644 --- a/gio/gunixmounts.c +++ b/gio/gunixmounts.c @@ -1637,17 +1637,17 @@ mount_monitor_start (void) const gchar *mtab_path; mtab_path = get_mtab_monitor_file (); - /* /proc/mounts monitoring is special - can't just use GFileMonitor. + /* Monitoring files in /proc/ is special - can't just use GFileMonitor. * See 'man proc' for more details. */ - if (g_strcmp0 (mtab_path, "/proc/mounts") == 0) + if (g_str_has_prefix (mtab_path, "/proc/")) { GIOChannel *proc_mounts_channel; GError *error = NULL; - proc_mounts_channel = g_io_channel_new_file ("/proc/mounts", "r", &error); + proc_mounts_channel = g_io_channel_new_file (mtab_path, "r", &error); if (proc_mounts_channel == NULL) { - g_warning ("Error creating IO channel for /proc/mounts: %s (%s, %d)", + g_warning ("Error creating IO channel for %s: %s (%s, %d)", mtab_path, error->message, g_quark_to_string (error->domain), error->code); g_error_free (error); }