forgotten mktemp call in composer code

This commit is contained in:
Milan Crha 2010-01-13 18:05:23 +00:00
parent 5f222fa4d6
commit f1f28dada3

View File

@ -1,3 +1,34 @@
diff --git a/composer/e-composer-autosave.c b/composer/e-composer-autosave.c
index a289866..f783e6c 100644
--- a/composer/e-composer-autosave.c
+++ b/composer/e-composer-autosave.c
@@ -91,6 +91,7 @@ static gboolean
composer_autosave_state_open (AutosaveState *state)
{
gchar *path;
+ gint fd;
if (state->file != NULL)
return TRUE;
@@ -100,13 +101,16 @@ composer_autosave_state_open (AutosaveState *state)
/* Since GIO doesn't have support for creating temporary files
* from a template (and in a given directory), we have to use
- * mktemp(), which brings a small risk of overwriting another
+ * g_mkstemp(), which brings a small risk of overwriting another
* autosave file. The risk is, however, miniscule. */
- if (mktemp (path) == NULL) {
+ fd = g_mkstemp (path)
+ if (fd == -1) {
g_free (path);
return FALSE;
}
+ close (fd);
+
/* Create the GFile */
state->file = g_file_new_for_path (path);
g_free (path);
diff --git a/e-util/e-mktemp.c b/e-util/e-mktemp.c diff --git a/e-util/e-mktemp.c b/e-util/e-mktemp.c
index 509b312..15b5668 100644 index 509b312..15b5668 100644
--- a/e-util/e-mktemp.c --- a/e-util/e-mktemp.c