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.
This commit is contained in:
Ondrej Holy 2020-02-18 09:10:03 +01:00
parent 972b977659
commit 898a9c332e

View File

@ -1890,6 +1890,7 @@ mount_monitor_start (void)
G_LOCK (proc_mounts_source); G_LOCK (proc_mounts_source);
proc_mounts_watch_source = g_io_create_watch (proc_mounts_channel, G_IO_ERR); 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, g_source_set_callback (proc_mounts_watch_source,
(GSourceFunc) proc_mounts_changed, (GSourceFunc) proc_mounts_changed,
NULL, NULL); NULL, NULL);