aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/folder-browser.c25
-rw-r--r--mail/mail-display.c1
3 files changed, 27 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index e2e51b16d6..fe585c7473 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,12 @@
2001-07-03 Jeffrey Stedfast <fejj@ximian.com>
+ * folder-browser.c (message_list_drag_data_get): Use mkdtemp if we
+ have it, else use mktemp but make the code safer than it was
+ previously.
+
+ * mail-display.c (launch_cb): Free the template string if the
+ tempdir failed to be created.
+
* folder-browser.c (message_list_drag_data_get): Hide the URL
passwd, auth, and params.
(folder_browser_copy): Same.
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index cee92b4d60..d9083333cc 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -188,24 +188,37 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
switch (info) {
case DND_TARGET_TYPE_TEXT_URI_LIST:
{
- char dir_template[] = "/tmp/evolution-XXXXXX";
- const char *dirname, *filename;
+ char *uri_list, tmpdir, *tmpl;
CamelMimeMessage *message;
+ const char *filename;
CamelStream *stream;
char *uri_list;
+ char *tmpdir;
int fd;
- dirname = mktemp (dir_template);
- if (!dirname) {
+ tmpl = g_strdup ("/tmp/evolution.XXXXXX");
+#ifdef HAVE_MKDTEMP
+ tmpdir = mkdtemp (tmpl);
+#else
+ tmpdir = mktemp (tmpl);
+ if (tmpdir) {
+ if (mkdir (tmpdir, S_IRWXU) == -1)
+ tmpdir = NULL;
+ }
+#endif
+ if (!tmpdir) {
+ char *msg = g_strdup_printf (_("Could not create temporary "
+ "directory: %s"),
+ g_strerror (errno));
+ gnome_error_dialog (msg);
/* cleanup and abort */
for (i = 0; i < uids->len; i++)
g_free (uids->pdata[i]);
g_ptr_array_free (uids, TRUE);
+ g_free (tmpl);
return;
}
- mkdir (dirname, 0700);
-
message = camel_folder_get_message (fb->folder, uids->pdata[0], NULL);
g_free (uids->pdata[0]);
diff --git a/mail/mail-display.c b/mail/mail-display.c
index bdb4c3096a..780ba43034 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -269,6 +269,7 @@ launch_cb (GtkWidget *widget, gpointer user_data)
"directory: %s"),
g_strerror (errno));
gnome_error_dialog (msg);
+ g_free (tmpl);
g_free (msg);
return;
}