brasero r1769 - in trunk: . src



Author: philippr
Date: Sat Jan 17 12:53:38 2009
New Revision: 1769
URL: http://svn.gnome.org/viewvc/brasero?rev=1769&view=rev

Log:
2009-01-17  Philippe Rouquier  <ykw localhost localdomain>

	Second part of the fix for #567582 â Fails to burn a DVD iso
	Because GIO doesn't follow a symlink that is pointed by another symlink,
	we ended up using wodim as if it were cdrecord
	Forbid the use of programs that are actually symlinks.

	* src/brasero-session-cfg.c (brasero_session_cfg_update):
	* src/burn-process.c (brasero_process_check_path):


Modified:
   trunk/ChangeLog
   trunk/src/brasero-session-cfg.c
   trunk/src/burn-process.c

Modified: trunk/src/brasero-session-cfg.c
==============================================================================
--- trunk/src/brasero-session-cfg.c	(original)
+++ trunk/src/brasero-session-cfg.c	Sat Jan 17 12:53:38 2009
@@ -674,7 +674,6 @@
 		result = brasero_burn_caps_is_session_supported (priv->caps,
 								 BRASERO_BURN_SESSION (self),
 								 FALSE);
-
 		if (result != BRASERO_BURN_OK
 		&&  source.type == BRASERO_TRACK_TYPE_AUDIO
 		&& (source.subtype.audio_format & BRASERO_METADATA_INFO)) {

Modified: trunk/src/burn-process.c
==============================================================================
--- trunk/src/burn-process.c	(original)
+++ trunk/src/burn-process.c	Sat Jan 17 12:53:38 2009
@@ -89,6 +89,7 @@
 static GObjectClass *parent_class = NULL;
 
 /* This is a helper function for plugins at load time */
+
 gboolean
 brasero_process_check_path (const gchar *name,
 			    gchar **error)
@@ -103,49 +104,30 @@
 		return BRASERO_BURN_ERR;
 	}
 
-	/* make sure that's not a symlink pointing to something with another
-	 * name like wodim. */
-	if (g_file_test (prog_path, G_FILE_TEST_IS_SYMLINK)) {
-		GFile *file;
-		GFileInfo *info;
-		gchar *prog_name;
-		const gchar *target;
-
-		file = g_file_new_for_path (prog_path);
+	if (!g_file_test (prog_path, G_FILE_TEST_IS_EXECUTABLE)) {
 		g_free (prog_path);
+		*error = g_strdup_printf (_("\"%s\" could not be found in the path"), name);
+		return BRASERO_BURN_ERR;
+	}
 
-		if (!file) {
-			*error = g_strdup_printf (_("\"%s\" could not be found in the path"), name);
-			return BRASERO_BURN_ERR;
-		}
-
-		info = g_file_query_info (file,
-					  G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
-					  G_FILE_QUERY_INFO_NONE,
-					  NULL,
-					  NULL);
-		g_object_unref (file);
-
-		if (!info) {
-			*error = g_strdup_printf (_("\"%s\" could not be found in the path"), name);
-			return BRASERO_BURN_ERR;
-		}
-
-		target = g_file_info_get_symlink_target (info);
-		prog_name = g_path_get_basename (target);
-		g_object_unref (info);
-
-		if (!prog_name || strcmp (prog_name, name)) {
-			g_free (prog_name);
-			*error = g_strdup_printf (_("\"%s\" is a symlink pointing to another program. Use the target program instead"), name);
-			return BRASERO_BURN_ERR;
-		}
-
-		g_free (prog_name);
+	/* make sure that's not a symlink pointing to something with another
+	 * name like wodim.
+	 * NOTE: we used to test the target and see if it had the same name as
+	 * the symlink with GIO. The problem is, when the symlink pointed to
+	 * another symlink, then GIO didn't follow that other symlink. And in
+	 * the end it didn't work. So forbid all symlink. */
+	if (g_file_test (prog_path, G_FILE_TEST_IS_SYMLINK)) {
+		*error = g_strdup_printf (_("\"%s\" is a symlink pointing to another program. Use the target program instead"), name);
+		return BRASERO_BURN_ERR;
 	}
-	else
+	/* Make sure it's a regular file */
+	else if (!g_file_test (prog_path, G_FILE_TEST_IS_REGULAR)) {
+		*error = g_strdup_printf (_("\"%s\" could not be found in the path"), name);
 		g_free (prog_path);
+		return BRASERO_BURN_ERR;
+	}
 
+	g_free (prog_path);
 	return BRASERO_BURN_OK;
 }
 



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