diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2003-11-21 01:16:24 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-11-21 01:16:24 +0800 |
commit | 973e5dccd2e75bb58c5e532f137b6c7f1391eb5e (patch) | |
tree | a176d6ab4cb65abcfaac94dd594ea091ec60d1e3 | |
parent | a9520520d997a08879efbf1f7169298c30b53c49 (diff) | |
download | gsoc2013-epiphany-973e5dccd2e75bb58c5e532f137b6c7f1391eb5e.tar gsoc2013-epiphany-973e5dccd2e75bb58c5e532f137b6c7f1391eb5e.tar.gz gsoc2013-epiphany-973e5dccd2e75bb58c5e532f137b6c7f1391eb5e.tar.bz2 gsoc2013-epiphany-973e5dccd2e75bb58c5e532f137b6c7f1391eb5e.tar.lz gsoc2013-epiphany-973e5dccd2e75bb58c5e532f137b6c7f1391eb5e.tar.xz gsoc2013-epiphany-973e5dccd2e75bb58c5e532f137b6c7f1391eb5e.tar.zst gsoc2013-epiphany-973e5dccd2e75bb58c5e532f137b6c7f1391eb5e.zip |
Make xml saving low disk safe.
2003-11-20 Marco Pesenti Gritti <marco@gnome.org>
* src/ephy-session.c: (ephy_session_save):
Make xml saving low disk safe.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/ephy-session.c | 14 |
2 files changed, 18 insertions, 2 deletions
@@ -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") |