brasero r1620 - in trunk: . src src/plugins/checksum



Author: philippr
Date: Sat Dec 13 15:01:04 2008
New Revision: 1620
URL: http://svn.gnome.org/viewvc/brasero?rev=1620&view=rev

Log:
	Fix for #563989 â brasero crashs on fifo-files

	* src/brasero-io.c (brasero_io_get_file_info_thread_real),
	(brasero_io_get_file_count_process_directory),
	(brasero_io_get_file_count_start), (brasero_io_xfer_start):
	* src/plugins/checksum/burn-checksum-files.c
	(brasero_checksum_files_explore_directory),
	(brasero_checksum_files_check_files):


Modified:
   trunk/ChangeLog
   trunk/src/brasero-io.c
   trunk/src/plugins/checksum/burn-checksum-files.c

Modified: trunk/src/brasero-io.c
==============================================================================
--- trunk/src/brasero-io.c	(original)
+++ trunk/src/brasero-io.c	Sat Dec 13 15:01:04 2008
@@ -1119,8 +1119,9 @@
 
 	/* see if we are supposed to get metadata for this file (provided it's
 	 * an audio file of course). */
-	if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY
-	&&  options & BRASERO_IO_INFO_METADATA) {
+	if ((g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR
+	||   g_file_info_get_file_type (info) == G_FILE_TYPE_SYMBOLIC_LINK)
+	&&  (options & BRASERO_IO_INFO_METADATA)) {
 		BraseroMetadataInfo metadata = { NULL };
 		BraseroMetadataFlag flags;
 		gboolean result;
@@ -1627,12 +1628,15 @@
 
 		child = g_file_get_child (file, g_file_info_get_name (info));
 
-		if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY) {
+		if (g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR
+		||  g_file_info_get_file_type (info) == G_FILE_TYPE_SYMBOLIC_LINK) {
 			brasero_io_get_file_count_process_file (self, cancel, data, child, info);
 			g_object_unref (child);
 		}
-		else
+		else if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
 			data->children = g_slist_prepend (data->children, child);
+		else
+			g_object_unref (child);
 
 		g_object_unref (info);
 	}
@@ -1672,12 +1676,17 @@
 		return FALSE;
 	}
 
-	if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY) {
+	if (g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR
+	||  g_file_info_get_file_type (info) == G_FILE_TYPE_SYMBOLIC_LINK) {
 		brasero_io_get_file_count_process_file (self, cancel, data, file, info);
 		g_object_unref (file);
 	}
-	else if (data->job.options & BRASERO_IO_INFO_RECURSIVE)
-		data->children = g_slist_prepend (data->children, file);
+	else if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+		if (data->job.options & BRASERO_IO_INFO_RECURSIVE)
+			data->children = g_slist_prepend (data->children, file);
+		else
+			g_object_unref (file);
+	}
 	else
 		g_object_unref (file);
 
@@ -2403,9 +2412,10 @@
 	/* see if we should explore it beforehand to report progress */
 	if (data->count.job.base->progress) {
 		data->count.files_num = 1;
-		if (g_file_info_get_file_type (data->info) != G_FILE_TYPE_DIRECTORY)
+		if (g_file_info_get_file_type (data->info) == G_FILE_TYPE_REGULAR
+		||  g_file_info_get_file_type (data->info) == G_FILE_TYPE_SYMBOLIC_LINK)
 			brasero_io_get_file_count_process_file (self, cancel, &data->count, file, data->info);
-		else
+		else if (g_file_info_get_file_type (data->info) == G_FILE_TYPE_DIRECTORY)
 			brasero_io_get_file_count_process_directory (self, cancel, &data->count);
 	}
 
@@ -2431,7 +2441,8 @@
 							  data->dest_path,
 							  NULL);
 	}
-	else
+	else if (g_file_info_get_file_type (data->info) == G_FILE_TYPE_REGULAR
+	     ||  g_file_info_get_file_type (data->info) == G_FILE_TYPE_SYMBOLIC_LINK)
 		result = brasero_io_xfer_file_thread (data,
 						      cancel,
 						      file,

Modified: trunk/src/plugins/checksum/burn-checksum-files.c
==============================================================================
--- trunk/src/plugins/checksum/burn-checksum-files.c	(original)
+++ trunk/src/plugins/checksum/burn-checksum-files.c	Sat Dec 13 15:01:04 2008
@@ -261,6 +261,13 @@
 			continue;
 		}
 
+		/* Only checksum regular files and avoid fifos, ... */
+		if (!g_file_test (path, G_FILE_TEST_IS_REGULAR)) {
+			g_free (path);
+			g_free (graft_path);
+			continue;
+		}
+
 		result = brasero_checksum_files_add_file_checksum (self,
 								   path,
 								   checksum_type,
@@ -733,7 +740,12 @@
 
 	/* we need to get the number of files at this time and rewind */
 	file_nb = brasero_checksum_files_get_line_num (self, file, error);
-	if (file_nb < 1) {
+	if (file_nb == 0) {
+		fclose (file);
+		return BRASERO_BURN_OK;
+	}
+
+	if (file_nb < 0) {
 		g_set_error (error,
 			     BRASERO_BURN_ERROR,
 			     BRASERO_BURN_ERROR_GENERAL,
@@ -849,6 +861,11 @@
 
 		filename [i] = 0;
 		checksum_real = NULL;
+
+		/* we certainly don't want to checksum anything but regular file */
+		if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR))
+			continue;
+
 		result = brasero_checksum_files_get_file_checksum (self,
 								   gchecksum_type,
 								   filename,



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