Re: Should find_directory() canonicalize all symlinks?
- From: Federico Mena Quintero <federico ximian com>
- To: Alexander Larsson <alexl redhat com>
- Cc: "gnome-vfs-list gnome org" <gnome-vfs-list gnome org>
- Subject: Re: Should find_directory() canonicalize all symlinks?
- Date: Fri, 08 Jul 2005 17:00:51 -0500
On Fri, 2005-07-08 at 09:51 +0200, Alexander Larsson wrote:
> Yes, that sounds right. In fact, the canonicalization was introduced to
> fix a problem like this that garret had, because his home directory was
> a symlink.
Great! I just committed this:
2005-07-08 Federico Mena Quintero <federico ximian com>
* libgnomevfs/gnome-vfs-cancellable-ops.c
(gnome_vfs_find_directory_cancellable): Canonicalize the near_uri
unconditionally. If we are finding a trash directory, we also
need to look at the real device, not the device on which the
symlink is stored. Also, return an error if we cannot
canonicalize the symlink.
--- gnome-vfs-cancellable-ops.c.orig 2005-07-08 13:30:01.877132811 -0500
+++ gnome-vfs-cancellable-ops.c 2005-07-08 13:38:50.397820577 -0500
@@ -289,18 +289,21 @@
} else {
/* assume file: method and the home directory */
near_uri = gnome_vfs_uri_new (g_get_home_dir());
- /* Need to expand the final symlink, since if the homedir is a symlink
- * we want to look at the device the home symlink points to, not the
- * one the symlink is stored on */
- if (_gnome_vfs_uri_resolve_all_symlinks_uri (near_uri,
- &resolved_uri) == GNOME_VFS_OK) {
- gnome_vfs_uri_unref (near_uri);
- near_uri = resolved_uri;
- }
}
+ /* 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
+ */
+ result = _gnome_vfs_uri_resolve_all_symlinks_uri (near_uri, &resolved_uri);
+ if (result == GNOME_VFS_OK) {
+ gnome_vfs_uri_unref (near_uri);
+ near_uri = resolved_uri;
+ } else
+ return result;
+
g_assert (near_uri != NULL);
-
+
if (!VFS_METHOD_HAS_FUNC(near_uri->method, find_directory)) {
gnome_vfs_uri_unref (near_uri);
return GNOME_VFS_ERROR_NOT_SUPPORTED;
It solves the problem for me.
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]