gunixmounts: Use mnt_monitor_veil_kernel option

The previous commit enabled the `/run/mount/utab` monitoring. The problem
is that the `mount-changed` signal can be emitted twice for one mount. One
for the `/proc/mounts` file change and another one for the `/run/media/utab`
file change. This is still not ideal because e.g. the `GMount` objects for
mounts with the `x-gvfs-hide` option are added and immediately removed.
Let's enable the `mnt_monitor_veil_kernel` option to avoid this.

Related: https://github.com/util-linux/util-linux/pull/2725
This commit is contained in:
Ondrej Holy 2024-01-31 13:35:39 +01:00
parent 1abbbd761e
commit c7254fb3ad
2 changed files with 10 additions and 0 deletions

View File

@ -2053,6 +2053,12 @@ mount_monitor_start (void)
if (ret < 0)
g_warning ("mnt_monitor_enable_userspace failed: %s", g_strerror (-ret));
#ifdef HAVE_MNT_MONITOR_VEIL_KERNEL
ret = mnt_monitor_veil_kernel (proc_mounts_monitor, TRUE);
if (ret < 0)
g_warning ("mnt_monitor_veil_kernel failed: %s", g_strerror (-ret));
#endif
ret = mnt_monitor_get_fd (proc_mounts_monitor);
if (ret >= 0)
{

View File

@ -2245,6 +2245,10 @@ libmount_dep = []
if host_system == 'linux'
libmount_dep = dependency('mount', version : '>=2.23', required : get_option('libmount'))
glib_conf.set('HAVE_LIBMOUNT', libmount_dep.found())
if libmount_dep.found() and cc.has_function('mnt_monitor_veil_kernel', dependencies: libmount_dep)
glib_conf.set('HAVE_MNT_MONITOR_VEIL_KERNEL', 1)
endif
endif
if host_system == 'windows'