1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
Index: gnome-vfs-2.24.2/modules/file-method.c
===================================================================
--- gnome-vfs-2.24.2.orig/modules/file-method.c 2010-02-06 11:55:46.645282580 +0100
+++ gnome-vfs-2.24.2/modules/file-method.c 2010-02-06 11:55:46.929283842 +0100
@@ -1257,6 +1257,7 @@
struct stat statbuf;
gboolean is_local;
gchar *path;
+ char *type;
g_return_val_if_fail (uri != NULL, FALSE);
@@ -1264,22 +1265,23 @@
if (path == NULL)
return TRUE; /* GNOME_VFS_ERROR_INVALID_URI */
- if (g_stat (path, &statbuf) == 0) {
- char *type;
-
- G_LOCK (fstype);
- type = filesystem_type (path, path, &statbuf);
- is_local = ((strcmp (type, "nfs") != 0) &&
- (strcmp (type, "afs") != 0) &&
- (strcmp (type, "autofs") != 0) &&
- (strcmp (type, "unknown") != 0) &&
- (strcmp (type, "novfs") != 0) &&
- (strcmp (type, "ncpfs") != 0));
- G_UNLOCK (fstype);
- } else {
- /* Assume non-existent files are local */
- is_local = TRUE;
+ /* Recurse through directories until one of them exists */
+ while (g_stat (path, &statbuf) != 0) {
+ gchar *tmp_path = g_path_get_dirname (path);
+ g_free (path);
+ path = tmp_path;
}
+
+ G_LOCK (fstype);
+ type = filesystem_type (path, path, &statbuf);
+ is_local = ((strcmp (type, "nfs") != 0) &&
+ (strcmp (type, "afs") != 0) &&
+ (strcmp (type, "autofs") != 0) &&
+ (strcmp (type, "unknown") != 0) &&
+ (strcmp (type, "novfs") != 0) &&
+ (strcmp (type, "ncpfs") != 0));
+ G_UNLOCK (fstype);
+
g_free (path);
return is_local;
}
|