evince r3597 - in trunk: . shell
- From: carlosgc svn gnome org
- To: svn-commits-list gnome org
- Subject: evince r3597 - in trunk: . shell
- Date: Fri, 10 Apr 2009 13:57:32 +0000 (UTC)
Author: carlosgc
Date: Fri Apr 10 13:57:32 2009
New Revision: 3597
URL: http://svn.gnome.org/viewvc/evince?rev=3597&view=rev
Log:
2009-04-10 Carlos Garcia Campos <carlosgc gnome org>
* shell/ev-window.c: (ev_window_create_tmp_symlink):
Use g_file_make_symbolic_link to create symlinks. Patch by Hib
Eris. See bug #339172.
Modified:
trunk/ChangeLog
trunk/shell/ev-window.c
Modified: trunk/shell/ev-window.c
==============================================================================
--- trunk/shell/ev-window.c (original)
+++ trunk/shell/ev-window.c Fri Apr 10 13:57:32 2009
@@ -2069,10 +2069,11 @@
static gchar *
ev_window_create_tmp_symlink (const gchar *filename, GError **error)
{
- gchar *tmp_filename = NULL;
- gchar *name;
- gint res;
- guint i = 0;
+ gchar *tmp_filename = NULL;
+ gchar *name;
+ guint i = 0;
+ GError *link_error = NULL;
+ GFile *tmp_file = NULL;
name = g_path_get_basename (filename);
@@ -2081,29 +2082,32 @@
if (tmp_filename)
g_free (tmp_filename);
+ if (tmp_file)
+ g_object_unref (tmp_file);
+ g_clear_error (&link_error);
basename = g_strdup_printf ("%s-%d", name, i++);
tmp_filename = g_build_filename (ev_tmp_dir (),
basename, NULL);
g_free (basename);
- } while ((res = symlink (filename, tmp_filename)) != 0 && errno == EEXIST);
-
- g_free (name);
+ tmp_file = g_file_new_for_path (tmp_filename);
+ } while (!g_file_make_symbolic_link (tmp_file, filename, NULL, &link_error) &&
+ g_error_matches (link_error, G_IO_ERROR, G_IO_ERROR_EXISTS));
- if (res != 0 && errno != EEXIST) {
- if (error) {
- *error = g_error_new (G_FILE_ERROR,
- g_file_error_from_errno (errno),
- _("Couldn't create symlink â%sâ: %s"),
- tmp_filename, strerror (errno));
- }
+ g_free (name);
+ g_object_unref (tmp_file);
+ if (link_error) {
+ g_propagate_prefixed_error (error,
+ link_error,
+ _("Couldn't create symlink â%sâ: "),
+ tmp_filename);
g_free (tmp_filename);
-
+
return NULL;
}
-
+
return tmp_filename;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]