From 9dd322498616fdbd37beebee0f916890c74fd2b0 Mon Sep 17 00:00:00 2001 From: djcb Date: Mon, 23 Apr 2012 08:06:58 +0300 Subject: [PATCH] * msg2pdf.c: create tempdir before trying to save --- toys/msg2pdf/msg2pdf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/toys/msg2pdf/msg2pdf.c b/toys/msg2pdf/msg2pdf.c index dda83ead..7ff6bce5 100644 --- a/toys/msg2pdf/msg2pdf.c +++ b/toys/msg2pdf/msg2pdf.c @@ -71,8 +71,7 @@ save_file_for_cid (MuMsg *msg, const char* cid) g_warning ("%s: failed to save %s: %s", __FUNCTION__, filepath, err&&err->message?err->message:"error"); - if (err) - g_error_free (err); + g_clear_error (&err); g_free (filepath); filepath = NULL; } @@ -144,6 +143,11 @@ generate_pdf (MuMsg *msg, const char *str, GError **err) path = g_strdup_printf ("%s%c%x.pdf",mu_util_cache_dir(), G_DIR_SEPARATOR, (unsigned)random()); + if (!mu_util_create_dir_maybe (mu_util_cache_dir(),0700,FALSE)) { + g_warning ("Couldn't create tempdir"); + return FALSE; + } + start = time (NULL); do {