gnome-vfs (1:2.24.3-1) 08_recursive_local_check.patch

Summary

 modules/file-method.c |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

    
download this patch

Patch contents

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;
 }