[glib/wip/oholy/gunixmountmonitor-thread-safe: 2/4] gunixmounts: Prevent invalid time_read timestamps
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/oholy/gunixmountmonitor-thread-safe: 2/4] gunixmounts: Prevent invalid time_read timestamps
- Date: Tue, 18 Feb 2020 08:21:15 +0000 (UTC)
commit 898a9c332e5c238bfbac8e64441286dac5ebe61e
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]