From bd3790d66e3f9f6f90193dac94758a964191f1ab Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Thu, 14 Mar 2002 21:05:47 +0000 Subject: create new signature file (delete_unused_signature_file): be more careful 2002-03-14 Radek Doulik * mail-config.c (get_new_signature_filename): create new signature file (delete_unused_signature_file): be more careful about signature file path before unlinking svn path=/trunk/; revision=16167 --- mail/ChangeLog | 7 +++++++ mail/mail-config.c | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'mail') 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 + + * 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 * 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 -- cgit v1.2.3