Re: Opening files that start with %
- From: James Henstridge <james daa com au>
- To: jgotts linuxsavvy com
- Cc: Ben FrantzDale <bfrantzdale hmc edu>, gnome-list gnome org, gnome-devel-list gnome org
- Subject: Re: Opening files that start with %
- Date: Thu Jul 25 21:42:11 2002
jgotts linuxsavvy com wrote:
http://bugzilla.gnome.org/show_bug.cgi?id=88899
It should be noted that you fixed the bug for gedit 2.0 *only*. Attached is
a patch for gedit 0.9.7 that appears to work. As the original reporter noted,
other applications such as nautilus will have to be checked and fixed as well.
I'll leave that to some other brave soul.
John
--- gedit-0.9.7/src/file.c.orig Thu Jul 25 20:31:24 2002
+++ gedit-0.9.7/src/file.c Thu Jul 25 20:32:40 2002
@@ -195,6 +195,7 @@
GnomeVFSResult result;
GString *tmp_buf = NULL;
GeditView *view;
+ char *safe_fname;
gedit_debug (DEBUG_FILE, "");
@@ -207,7 +208,8 @@
gtk_main_iteration ();
info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info (fname,
+ safe_fname = gnome_vfs_escape_path_string(fname);
+ result = gnome_vfs_get_file_info (safe_fname,
info,
(GNOME_VFS_FILE_INFO_GET_MIME_TYPE
| GNOME_VFS_FILE_INFO_FOLLOW_LINKS));
@@ -251,7 +253,7 @@
return 1;
}
- result = gnome_vfs_open (&from_handle, fname, GNOME_VFS_OPEN_READ);
+ result = gnome_vfs_open (&from_handle, safe_fname, GNOME_VFS_OPEN_READ);
if (result != GNOME_VFS_OK)
{
gchar *errstr = g_strdup_printf (_("An error was encountered while reading the file: \n\n%s\n\n"
The patch above appears to leak safe_fname.
James.
--
Email: james daa com au | Linux.conf.au 2003 Call for Papers out
WWW: http://www.daa.com.au/~james/ | http://conf.linux.org.au/cfp.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]