aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/ephy-session.c14
2 files changed, 18 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 62db0477d..17127ef59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2003-11-20 Marco Pesenti Gritti <marco@gnome.org>
+ * src/ephy-session.c: (ephy_session_save):
+
+ Make xml saving low disk safe.
+
+2003-11-20 Marco Pesenti Gritti <marco@gnome.org>
+
* src/ephy-window.c: (show_embed_popup):
Fix unrefing of context menu event
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 18900e87e..75347d7cf 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -496,7 +496,7 @@ ephy_session_save (EphySession *session,
{
xmlTextWriterPtr writer;
GList *w;
- char *save_to;
+ char *save_to, *tmp_file;
int ret;
LOG ("ephy_sesion_save %s", filename)
@@ -508,9 +508,11 @@ ephy_session_save (EphySession *session,
}
save_to = get_session_filename (filename);
+ tmp_file = g_strconcat (save_to, ".tmp", NULL);
/* FIXME: do we want to turn on compression? */
- writer = xmlNewTextWriterFilename (save_to, 0);
+ writer = xmlNewTextWriterFilename (tmp_file, 0);
+ g_free (tmp_file);
if (writer == NULL)
{
return FALSE;
@@ -554,6 +556,14 @@ ephy_session_save (EphySession *session,
out:
xmlFreeTextWriter (writer);
+ if (ret >= 0)
+ {
+ if (ephy_file_switch_temp_file (save_to, tmp_file) == FALSE)
+ {
+ ret = -1;
+ }
+ }
+
g_free (save_to);
STOP_PROFILER ("Saving session")