Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/backend/comics
diff options
context:
space:
mode:
authorChristian Persch <chpe@gnome.org>2009-10-25 15:04:20 (GMT)
committer Christian Persch <chpe@gnome.org>2009-10-25 18:38:22 (GMT)
commit0f1c723ad2fe48a0f22e32619985f93ebb2e02ef (patch)
tree73a10753be7590bbbd81af531de7d8b2400f7068 /backend/comics
parent6635e60321ca8e4607c30f3303742ca2df559b3c (diff)
libdocument: Clean up temp file handling
t push origin HEAD:master Make sure we can cope with not being able to create our temp directory. Bug #595372.
Diffstat (limited to 'backend/comics')
-rw-r--r--backend/comics/comics-document.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c
index fbe6ba0..b53d513 100644
--- a/backend/comics/comics-document.c
+++ b/backend/comics/comics-document.c
@@ -205,32 +205,20 @@ comics_generate_command_lines (ComicsDocument *comics_document,
comics_document->regex_arg = command_usage_def[type].regex_arg;
comics_document->offset = command_usage_def[type].offset;
if (command_usage_def[type].decompress_tmp) {
- comics_document->dir = ev_tmp_directory (NULL);
- comics_document->decompress_tmp =
+ comics_document->dir = ev_mkdtemp ("comics.XXXXXX", error);
+ if (comics_document->dir == NULL)
+ return FALSE;
+
+ /* unrar-free can't create directories, but ev_mkdtemp already created the dir */
+
+ comics_document->decompress_tmp =
g_strdup_printf (command_usage_def[type].decompress_tmp,
comics_document->selected_command,
quoted_file,
comics_document->dir);
g_free (quoted_file);
- /* unrar-free can't create directories so we do it on its
- * behalf */
- if (type == GNAUNRAR) {
- if (g_mkdir_with_parents (comics_document->dir, 0700) !=
- 0) {
- int errsv = errno;
- g_set_error (error,
- EV_DOCUMENT_ERROR,
- EV_DOCUMENT_ERROR_INVALID,
- _("Failed to create a temporary "
- "directory."));
- g_warning ("Failed to create directory %s: %s",
- comics_document->dir,
- g_strerror (errsv));
-
- return FALSE;
- }
- }
- if (!comics_decompress_temp_dir (comics_document->decompress_tmp,
+
+ if (!comics_decompress_temp_dir (comics_document->decompress_tmp,
comics_document->selected_command, error))
return FALSE;
else
@@ -713,7 +701,6 @@ comics_document_finalize (GObject *object)
g_warning (_("There was an error deleting ā€œ%sā€."),
comics_document->dir);
g_free (comics_document->dir);
- g_remove (ev_tmp_dir ());
}
if (comics_document->page_names) {