aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1998-11-12 08:32:45 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-11-12 08:32:45 +0800
commit1fa38d37db36871b9c9b252c66bbba66087c6a99 (patch)
treef47a35212453ded5c981062475ad036829298160 /calendar/gui/calendar.c
parentc5cb76042a816d51c017d6b709d1c2485a47ff6b (diff)
downloadgsoc2013-evolution-1fa38d37db36871b9c9b252c66bbba66087c6a99.tar
gsoc2013-evolution-1fa38d37db36871b9c9b252c66bbba66087c6a99.tar.gz
gsoc2013-evolution-1fa38d37db36871b9c9b252c66bbba66087c6a99.tar.bz2
gsoc2013-evolution-1fa38d37db36871b9c9b252c66bbba66087c6a99.tar.lz
gsoc2013-evolution-1fa38d37db36871b9c9b252c66bbba66087c6a99.tar.xz
gsoc2013-evolution-1fa38d37db36871b9c9b252c66bbba66087c6a99.tar.zst
gsoc2013-evolution-1fa38d37db36871b9c9b252c66bbba66087c6a99.zip
Backup the old file before saving the caledar.
1998-11-11 Miguel de Icaza <miguel@nuclecu.unam.mx> * calendar.c (calendar_save): Backup the old file before saving the caledar. svn path=/trunk/; revision=467
Diffstat (limited to 'calendar/gui/calendar.c')
-rw-r--r--calendar/gui/calendar.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c
index 963f91be06..374fb6874a 100644
--- a/calendar/gui/calendar.c
+++ b/calendar/gui/calendar.c
@@ -13,7 +13,7 @@
*/
#include <config.h>
-
+#include <unistd.h>
#include "alarm.h"
#include "calendar.h"
#include "timeutil.h"
@@ -338,7 +338,17 @@ calendar_save (Calendar *cal, char *fname)
addVObjectProp (vcal, obj);
}
+ if (g_file_exists (fname)){
+ char *backup_name = g_copy_strings (fname, "~", NULL);
+
+ if (g_file_exists (backup_name)){
+ unlink (backup_name);
+ }
+ rename (fname, backup_name);
+ g_free (backup_name);
+ }
writeVObjectToFile (fname, vcal);
+
cleanVObject (vcal);
cleanStrTbl ();
}