diff options
-rw-r--r-- | mail/ChangeLog | 7 | ||||
-rw-r--r-- | mail/mail-config.c | 17 |
2 files changed, 21 insertions, 3 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 9c9ee5e007..0066b90955 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2002-03-14 Radek Doulik <rodo@ximian.com> + + * mail-config.c (get_new_signature_filename): create new signature + file + (delete_unused_signature_file): be more careful about signature + file path before unlinking + 2002-03-14 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (next_thread): Implemented. diff --git a/mail/mail-config.c b/mail/mail-config.c index a2b9eeacdc..63984cd476 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -2840,7 +2840,13 @@ get_new_signature_filename () for (i = 0; ; i ++) { filename = g_strdup_printf ("%s/signatures/signature-%d", evolution_dir, i); if (lstat (filename, &st_buf) == - 1 && errno == ENOENT) { - return filename; + gint fd; + + fd = creat (filename, 0600); + if (fd >= 0) { + close (fd); + return filename; + } } g_free (filename); } @@ -2877,10 +2883,13 @@ static void delete_unused_signature_file (const gchar *filename) { gint len; + gchar *signatures_dir; + + signatures_dir = g_strconcat (evolution_dir, "/signatures", NULL); /* remove signature file if it's in evolution dir and no other signature uses it */ - len = strlen (evolution_dir); - if (filename && !strncmp (filename, evolution_dir, len)) { + len = strlen (signatures_dir); + if (filename && !strncmp (filename, signatures_dir, len)) { GList *l; gboolean only_one = TRUE; @@ -2896,6 +2905,8 @@ delete_unused_signature_file (const gchar *filename) unlink (filename); } } + + g_free (signatures_dir); } void |