View | Details | Raw Unified | Return to bug 250311
Collapse All | Expand All

(-)devel/glib20/files/patch-gio_gunixmounts.c (+33 lines)
Line 0 Link Here
1
--- gio/gunixmounts.c.orig	2020-10-01 16:17:53.138733000 +0300
2
+++ gio/gunixmounts.c	2020-10-18 01:26:30.563084000 +0300
3
@@ -1654,10 +1654,28 @@
4
 GList *
5
 g_unix_mount_points_get (guint64 *time_read)
6
 {
7
+  static GList *mnt_pts_last = NULL;
8
+  static guint64 time_read_last = 0;
9
+  GList *mnt_pts = NULL;
10
+  guint64 time_read_now;
11
+  G_LOCK_DEFINE_STATIC (unix_mount_points);
12
+
13
+  G_LOCK (unix_mount_points);
14
+
15
+  time_read_now = get_mount_points_timestamp ();
16
+  if (time_read_now != time_read_last || mnt_pts_last == NULL) {
17
+    time_read_last = time_read_now;
18
+    g_list_free_full (mnt_pts_last, (GDestroyNotify) g_unix_mount_point_free);
19
+    mnt_pts_last = _g_get_unix_mount_points ();
20
+  }
21
+  mnt_pts = g_list_copy_deep(mnt_pts_last, g_unix_mount_point_copy, NULL);
22
+
23
+  G_UNLOCK (unix_mount_points);
24
+
25
   if (time_read)
26
-    *time_read = get_mount_points_timestamp ();
27
+    *time_read = time_read_last;
28
 
29
-  return _g_get_unix_mount_points ();
30
+  return mnt_pts;
31
 }
32
 
33
 /**

Return to bug 250311