[glib/glib-2-62: 2/5] gunixmounts: Prevent invalid time_read timestamps



commit 1cd2ae372c9d567285d338c268ee89ee0a645b0a
Author: Ondrej Holy <oholy redhat com>
Date:   Tue Feb 18 09:10:03 2020 +0100

    gunixmounts: Prevent invalid time_read timestamps
    
    The `get_mounts_timestamp()` function uses `mount_poller_time` when
    `proc_mounts_watch_source` is set, but the `mount_poller_time` is not
    initialized in the same time as `proc_mounts_watch_source`. This may
    cause that zero, or some outdated value is returned. Let's initialize
    `mount_poller_time` to prevent invalid values to be returned.

 gio/gunixmounts.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index b716f22e4..8b12d8fbc 100644
--- a/gio/gunixmounts.c
+++ b/gio/gunixmounts.c
@@ -1890,6 +1890,7 @@ mount_monitor_start (void)
               G_LOCK (proc_mounts_source);
 
               proc_mounts_watch_source = g_io_create_watch (proc_mounts_channel, G_IO_ERR);
+              mount_poller_time = (guint64) g_get_monotonic_time ();
               g_source_set_callback (proc_mounts_watch_source,
                                      (GSourceFunc) proc_mounts_changed,
                                      NULL, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]