[PATCH] Return in gnome_vfs_find_directory if URI method doesn't support find_directory



Reported as bug 349241 [1]:

We currently resolve symlinks and then check for the near_uri supporting
find_directory. We could return I/O-less, though.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=349241

-- 
Christian Neumair <chris gnome-de org>
Index: libgnomevfs/gnome-vfs-cancellable-ops.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-cancellable-ops.c,v
retrieving revision 1.38
diff -u -p -r1.38 gnome-vfs-cancellable-ops.c
--- libgnomevfs/gnome-vfs-cancellable-ops.c	8 Nov 2005 11:22:43 -0000	1.38
+++ libgnomevfs/gnome-vfs-cancellable-ops.c	30 Jul 2006 09:34:27 -0000
@@ -300,6 +300,19 @@ gnome_vfs_find_directory_cancellable (Gn
 		near_uri = gnome_vfs_uri_new (g_get_home_dir());
 	}
 
+	g_assert (near_uri != NULL);
+
+	if (!VFS_METHOD_HAS_FUNC (near_uri->method, find_directory)) {
+		/* skip file systems not supporting find_directory.
+		 *
+		 * TODO if we decide to introduce cross-method links (e.g. http allows
+		 * arbitrary URIs), this could be slightly wrong, because the target
+		 * method may support find_directory, so we'd also have to make sure
+		 * that a method doesn't support cross-method links.
+		 **/
+		return GNOME_VFS_ERROR_NOT_SUPPORTED;
+	}
+
 	/* Need to expand the final symlink, since if the directory is a symlink
 	 * we want to look at the device the symlink points to, not the one the
 	 * symlink is stored on


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]