diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-session.c | 14 |
1 files changed, 12 insertions, 2 deletions
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") |