nautilus r15019 - in trunk: . libnautilus-private



Author: alexl
Date: Wed Feb 25 16:10:32 2009
New Revision: 15019
URL: http://svn.gnome.org/viewvc/nautilus?rev=15019&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/libnautilus-private/nautilus-file-operations.c

Modified: trunk/libnautilus-private/nautilus-file-operations.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file-operations.c	(original)
+++ trunk/libnautilus-private/nautilus-file-operations.c	Wed Feb 25 16:10:32 2009
@@ -4218,6 +4218,7 @@
 	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 @@
 
 	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 @@
 	}
 
 	g_free (dest_fs_type);
-	g_object_unref (inf);
 }
 
 static gboolean



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