Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-window.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2006-11-15 11:33:09 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2006-11-15 11:33:09 (GMT)
commit67654fe8c933af2932e2c87ec2a4560cb064c545 (patch)
treea272dcff310f3b4f7b9b34652d42db7cda755f67 /shell/ev-window.c
parent1dd619d11cc65d17b3fd08b650668fb3f85e35e9 (diff)
Use always ev_tmp_dir instead of g_get_tmp_dir. Fix a race condition in
2006-11-15 Carlos Garcia Campos <carlosgc@gnome.org> * backend/Makefile.am: * backend/ev-attachment.c: (ev_attachment_open): * lib/ev-file-helpers.[ch]: (ensure_dir_exists), (ev_dot_dir), (ev_tmp_dir), (ev_tmp_filename): * shell/ev-sidebar-attachments.c: (ev_sidebar_attachments_drag_data_get): * shell/ev-window.c: (ev_window_clear_temp_file): Use always ev_tmp_dir instead of g_get_tmp_dir. Fix a race condition in ensure_dir_exists. Abort without crashing when we can't create user's directory.
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r--shell/ev-window.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c
index c803140..436096c 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -994,7 +994,7 @@ ev_window_clear_temp_file (EvWindow *ev_window)
{
GnomeVFSURI *uri;
gchar *filename;
- gchar *dir;
+ const gchar *tempdir;
if (!ev_window->priv->uri)
return;
@@ -1010,12 +1010,11 @@ ev_window_clear_temp_file (EvWindow *ev_window)
if (!filename)
return;
- dir = g_path_get_dirname (filename);
- if (g_ascii_strcasecmp (dir, g_get_tmp_dir ()) == 0) {
+ tempdir = g_get_tmp_dir ();
+ if (g_ascii_strncasecmp (filename, tempdir, strlen (tempdir)) == 0) {
g_unlink (filename);
}
- g_free (dir);
g_free (filename);
}