From 92c9960521a23fcd239ac55fb3bd0cb07f22d18e Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Mon, 15 Jun 2020 17:43:49 +0200 Subject: [PATCH] glocalfile: Add SMB on the list of remote filesystems The G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE is set to TRUE only for NFS filesystem types currently. Let's add also SMB filesystem types. This also changes g_local_file_is_nfs_home function logic to handle only NFS filesystems. --- gio/glocalfile.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gio/glocalfile.c b/gio/glocalfile.c index 0ad39853f..4bb9948d8 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.c @@ -2532,6 +2532,12 @@ is_remote_fs_type (const gchar *fsname) return TRUE; if (strcmp (fsname, "nfs4") == 0) return TRUE; + if (strcmp (fsname, "cifs") == 0) + return TRUE; + if (strcmp (fsname, "smb") == 0) + return TRUE; + if (strcmp (fsname, "smb2") == 0) + return TRUE; } return FALSE; @@ -2540,7 +2546,7 @@ is_remote_fs_type (const gchar *fsname) gboolean g_local_file_is_nfs_home (const gchar *filename) { - static gboolean remote_home; + static gboolean remote_home = FALSE; static gsize initialized; const gchar *home; @@ -2557,7 +2563,8 @@ g_local_file_is_nfs_home (const gchar *filename) info = g_local_file_query_filesystem_info (file, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, NULL, NULL); if (info != NULL) fs_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE); - remote_home = is_remote_fs_type (fs_type); + if (g_strcmp0 (fs_type, "nfs") == 0 || g_strcmp0 (fs_type, "nfs4") == 0) + remote_home = TRUE; g_clear_object (&info); g_object_unref (file);