[glib] gunixmounts: Fix /proc/self/mountinfo monitoring
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gunixmounts: Fix /proc/self/mountinfo monitoring
- Date: Thu, 29 Sep 2016 08:34:35 +0000 (UTC)
commit bd9e266e116cd39bb5c674eeb74eb55449793e7f
Author: Ondrej Holy <oholy redhat com>
Date: Tue Sep 27 10:32:04 2016 +0200
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 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index f87ba5d..b5e066f 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]