diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-07-04 00:52:38 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-07-04 00:52:38 +0800 |
commit | ea9e4260969354a6479dceea253bb74d23c3acd9 (patch) | |
tree | efc55e0149a5678bf5e5395c7481ec72069cb316 | |
parent | 3f3936e0f9fb2acc990f0b0279740d740d945a24 (diff) | |
download | gsoc2013-evolution-ea9e4260969354a6479dceea253bb74d23c3acd9.tar gsoc2013-evolution-ea9e4260969354a6479dceea253bb74d23c3acd9.tar.gz gsoc2013-evolution-ea9e4260969354a6479dceea253bb74d23c3acd9.tar.bz2 gsoc2013-evolution-ea9e4260969354a6479dceea253bb74d23c3acd9.tar.lz gsoc2013-evolution-ea9e4260969354a6479dceea253bb74d23c3acd9.tar.xz gsoc2013-evolution-ea9e4260969354a6479dceea253bb74d23c3acd9.tar.zst gsoc2013-evolution-ea9e4260969354a6479dceea253bb74d23c3acd9.zip |
Use mkdtemp if we have it, else use mktemp but make the code safer than it
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.
svn path=/trunk/; revision=10753
-rw-r--r-- | mail/ChangeLog | 7 | ||||
-rw-r--r-- | mail/folder-browser.c | 25 | ||||
-rw-r--r-- | mail/mail-display.c | 1 |
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; } |