[gvfs/wip/oholy/bind-mounts] build: Use g_unix_mount_get_root_path conditionally
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/oholy/bind-mounts] build: Use g_unix_mount_get_root_path conditionally
- Date: Fri, 7 Dec 2018 12:11:21 +0000 (UTC)
commit e28dd3008e08b58456fa344b46b0bec9c9f1c0ea
Author: Ondrej Holy <oholy redhat com>
Date: Fri Dec 7 12:02:51 2018 +0100
build: Use g_unix_mount_get_root_path conditionally
GLib hasn't been released with g_unix_mount_get_root_path support yet,
so let's add macros to use this functionality only if available.
meson.build | 2 ++
monitor/udisks2/gvfsudisks2volumemonitor.c | 18 +++++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index 26877b6c..356c3442 100644
--- a/meson.build
+++ b/meson.build
@@ -227,6 +227,8 @@ gio_unix_dep = dependency('gio-unix-2.0')
glib_dep = dependency('glib-2.0', version: '>= 2.57.2')
gobject_dep = dependency('gobject-2.0')
+config_h.set('HAVE_G_UNIX_MOUNT_GET_ROOT_PATH', cc.has_function('g_unix_mount_get_root_path', dependencies:
gio_dep))
+
# *** Check for libXML ***
libxml_dep = dependency('libxml-2.0', required: false)
have_libxml = libxml_dep.found()
diff --git a/monitor/udisks2/gvfsudisks2volumemonitor.c b/monitor/udisks2/gvfsudisks2volumemonitor.c
index 29055845..951ee5d0 100644
--- a/monitor/udisks2/gvfsudisks2volumemonitor.c
+++ b/monitor/udisks2/gvfsudisks2volumemonitor.c
@@ -757,7 +757,11 @@ should_include_volume_check_mount_points (GVfsUDisks2VolumeMonitor *monitor,
mount_entry = g_unix_mount_at (mount_point, NULL);
if (mount_entry != NULL)
{
- const gchar *root = g_unix_mount_get_root_path (mount_entry);
+ const gchar *root = NULL;
+
+#ifdef HAVE_G_UNIX_MOUNT_GET_ROOT_PATH
+ root = g_unix_mount_get_root_path (mount_entry);
+#endif
if ((root == NULL || g_strcmp0 (root, "/") == 0) &&
should_include_mount (monitor, mount_entry))
@@ -1706,7 +1710,11 @@ update_mounts (GVfsUDisks2VolumeMonitor *monitor,
for (l = added; l != NULL; l = l->next)
{
GUnixMountEntry *mount_entry = l->data;
- const gchar *root = g_unix_mount_get_root_path (mount_entry);
+ const gchar *root = NULL;
+
+#ifdef HAVE_G_UNIX_MOUNT_GET_ROOT_PATH
+ root = g_unix_mount_get_root_path (mount_entry);
+#endif
volume = NULL;
if (root == NULL || g_strcmp0 (root, "/") == 0)
@@ -1742,7 +1750,11 @@ update_mounts (GVfsUDisks2VolumeMonitor *monitor,
}
if (gvfs_udisks2_mount_get_volume (mount) == NULL)
{
- const gchar *root = g_unix_mount_get_root_path (mount_entry);
+ const gchar *root = NULL;
+
+#ifdef HAVE_G_UNIX_MOUNT_GET_ROOT_PATH
+ root = g_unix_mount_get_root_path (mount_entry);
+#endif
volume = NULL;
if (root == NULL || g_strcmp0 (root, "/") == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]