[Commits] [SCM] claws branch, master, updated. 3.9.2-84-ge377eee

claws at claws-mail.org claws at claws-mail.org
Wed Aug 28 07:28:31 CEST 2013


The branch master of project "claws" (Claws Mail) has been updated
       via  e377eee114ead1ecafd829a5937869e9bead2584 (commit)
      from  76c91d8cceb7bdcdf8ede508fc1e1b349dcf930a (commit)


- Log -----------------------------------------------------------------
commit e377eee114ead1ecafd829a5937869e9bead2584
Author: Paul <paul at claws-mail.org>
Date:   Wed Aug 28 06:27:58 2013 +0100

    fix bug 2989, 'Segfault at startup because of corrupted folderlist.xml'

diff --git a/src/file_checker.c b/src/file_checker.c
index 5205070..fb4c89f 100644
--- a/src/file_checker.c
+++ b/src/file_checker.c
@@ -41,14 +41,16 @@
 
 static gboolean verify_folderlist_xml();
 
-gboolean check_file_integrity() {
+gboolean check_file_integrity()
+{
 	if (verify_folderlist_xml() != TRUE)
 		return FALSE;
 
 	return TRUE;
 }
 
-static gboolean verify_folderlist_xml() {
+static gboolean verify_folderlist_xml()
+{
 	GNode *node;
 	static gchar *filename = NULL;
 	static gchar *bak = NULL;
@@ -85,8 +87,8 @@ static gboolean verify_folderlist_xml() {
 			g_free(bak);
 			return TRUE;
 		}
-
 	}
+
  	node = xml_parse_file(filename);
   	if (!node && is_file_exist(bak)) {
 		AlertValue aval;
@@ -104,9 +106,29 @@ static gboolean verify_folderlist_xml() {
 				alertpanel_warning(_("Could not copy %s to %s"),bak,filename);
 				return FALSE;
 			}
-			g_free(bak);	
+			g_free(bak);
 		}
   	}
+  	
+  	if (is_file_exist(filename) && is_file_exist(bak) && folder_read_list() < 0) {
+		AlertValue aval;
+		gchar *msg;
 
-	return TRUE;	
+		msg = g_strdup_printf
+			(_("The file %s is corrupted! "
+			   "Do you want to use the backup file from %s?"), FOLDER_LIST,buf);
+		aval = alertpanel(_("Warning"), msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL);
+		g_free(msg);
+		if (aval != G_ALERTALTERNATE)
+			return FALSE;
+		else {
+			if (copy_file(bak,filename,FALSE) < 0) {
+				alertpanel_warning(_("Could not copy %s to %s"),bak,filename);
+				return FALSE;
+			}
+			g_free(bak);	
+		}		
+	}
+
+	return TRUE;
 }
diff --git a/src/folder.c b/src/folder.c
index 1b4ec03..93d7479 100644
--- a/src/folder.c
+++ b/src/folder.c
@@ -4068,6 +4068,8 @@ static gpointer xml_to_folder_item(gpointer nodedata, gpointer data)
 
 static gboolean folder_item_set_node(GNode *node, gpointer data)
 {
+	cm_return_val_if_fail(node->data != NULL, -1);
+
 	FolderItem *item = (FolderItem *) node->data;
 	item->node = node;
 

-----------------------------------------------------------------------

Summary of changes:
 src/file_checker.c |   32 +++++++++++++++++++++++++++-----
 src/folder.c       |    2 ++
 2 files changed, 29 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list