Don't unref info if == NULL Query for readonly on the source directory,

2009-02-25  Alexander Larsson  <alexl@redhat.com>

	* libnautilus-private/nautilus-file-operations.c (copy_files):
	Don't unref info if == NULL
	Query for readonly on the source directory, not the file because
	otherwise we'll follow symlinks to the wrong filesystem.
	OTOH, maybe query_filesystem_info shouldn't follow symlinks,
	but that unfortunately seems hard to implement.


svn path=/trunk/; revision=15019
This commit is contained in:
Alexander Larsson 2009-02-25 16:10:32 +00:00 committed by Alexander Larsson
parent a0f7bb5f2e
commit c03448e31d
2 changed files with 19 additions and 4 deletions

View file

@ -1,3 +1,12 @@
2009-02-25 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-file-operations.c (copy_files):
Don't unref info if == NULL
Query for readonly on the source directory, not the file because
otherwise we'll follow symlinks to the wrong filesystem.
OTOH, maybe query_filesystem_info shouldn't follow symlinks,
but that unfortunately seems hard to implement.
2009-02-25 Alexander Larsson <alexl@redhat.com>
* src/nautilus-application.c:

View file

@ -4218,6 +4218,7 @@ copy_files (CopyMoveJob *job,
gboolean skipped_file;
gboolean unique_names;
GFile *dest;
GFile *source_dir;
char *dest_fs_type;
GFileInfo *inf;
gboolean readonly_source_fs;
@ -4229,9 +4230,15 @@ copy_files (CopyMoveJob *job,
report_copy_progress (job, source_info, transfer_info);
inf = g_file_query_filesystem_info ((GFile *) job->files->data, "filesystem::readonly", NULL, NULL);
if (inf != NULL) {
readonly_source_fs = g_file_info_get_attribute_boolean (inf, "filesystem::readonly");
/* Query the source dir, not the file because if its a symlink we'll follow it */
source_dir = g_file_get_parent ((GFile *) job->files->data);
if (source_dir) {
inf = g_file_query_filesystem_info (source_dir, "filesystem::readonly", NULL, NULL);
if (inf != NULL) {
readonly_source_fs = g_file_info_get_attribute_boolean (inf, "filesystem::readonly");
g_object_unref (inf);
}
g_object_unref (source_dir);
}
unique_names = (job->destination == NULL);
@ -4274,7 +4281,6 @@ copy_files (CopyMoveJob *job,
}
g_free (dest_fs_type);
g_object_unref (inf);
}
static gboolean