aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Doulik <rodo@ximian.com>2002-03-15 05:05:47 +0800
committerRadek Doulik <rodo@src.gnome.org>2002-03-15 05:05:47 +0800
commitbd3790d66e3f9f6f90193dac94758a964191f1ab (patch)
tree96251b86d369df3e579281ab2b0d7fb556d296ee
parent4f298eab9e83c45991e7dce29ab556b90e080464 (diff)
downloadgsoc2013-evolution-bd3790d66e3f9f6f90193dac94758a964191f1ab.tar
gsoc2013-evolution-bd3790d66e3f9f6f90193dac94758a964191f1ab.tar.gz
gsoc2013-evolution-bd3790d66e3f9f6f90193dac94758a964191f1ab.tar.bz2
gsoc2013-evolution-bd3790d66e3f9f6f90193dac94758a964191f1ab.tar.lz
gsoc2013-evolution-bd3790d66e3f9f6f90193dac94758a964191f1ab.tar.xz
gsoc2013-evolution-bd3790d66e3f9f6f90193dac94758a964191f1ab.tar.zst
gsoc2013-evolution-bd3790d66e3f9f6f90193dac94758a964191f1ab.zip
create new signature file (delete_unused_signature_file): be more careful
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 svn path=/trunk/; revision=16167
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-config.c17
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