[Pkg-amule-commits] [SCM] Git repository for pkg-amule branch, master, updated. debian/2.3.1-8-2-g6461b4c

Sandro Tosi morph at debian.org
Sat Aug 4 13:06:01 UTC 2012


The following commit has been merged in the master branch:
commit bd952ab2b192681d92f1247dd859f48400e6a589
Author: Sandro Tosi <morph at debian.org>
Date:   Sat Aug 4 10:46:55 2012 +0200

    handle gracefully (ie not crashing) an empty statistics.dat file; thanks to florian for the report and to Michael Stapelberg for preparing the patch; Closes: #683680

diff --git a/debian/patches/handle_empty_statistics_file.patch b/debian/patches/handle_empty_statistics_file.patch
new file mode 100644
index 0000000..f215b09
--- /dev/null
+++ b/debian/patches/handle_empty_statistics_file.patch
@@ -0,0 +1,44 @@
+Description: Cope with empty statistics.dat file
+ If, for some reason (corruption), the ~/.aMule/statistics.dat is empty, aMule
+ will refuse to start until the file is deleted. This patch catches the
+ occuring exception, logs the problem, and then continues as if the file did
+ not exist in the first place.
+Bug-Debian: http://bugs.debian.org/683680
+Last-Update: 2012-02-11
+Origin: upstream, http://www.amule.org/abugs/view.php?id=1704
+Forwarded: not-needed
+
+Index: amule/src/Statistics.cpp
+===================================================================
+--- amule.orig/src/Statistics.cpp	2012-08-04 10:44:30.564102710 +0200
++++ amule/src/Statistics.cpp	2012-08-04 10:44:39.708219780 +0200
+@@ -50,6 +50,7 @@
+ #endif
+ 
+ #include "amule.h"		// Needed for theApp
++#include "Logger.h"
+ #include <wx/intl.h>
+ 
+ #ifdef __BSD__
+@@ -311,12 +312,16 @@
+ 
+ 	s_totalSent = 0;
+ 	s_totalReceived = 0;
+-	if (f.Open(JoinPaths(theApp->ConfigDir, wxT("statistics.dat")))) {
+-		uint8_t version = f.ReadUInt8();
+-		if (version == 0) {
+-			s_totalSent = f.ReadUInt64();
+-			s_totalReceived = f.ReadUInt64();
++	try {
++		if (f.Open(JoinPaths(theApp->ConfigDir, wxT("statistics.dat")))) {
++			uint8_t version = f.ReadUInt8();
++			if (version == 0) {
++				s_totalSent = f.ReadUInt64();
++				s_totalReceived = f.ReadUInt64();
++			}
+ 		}
++	} catch (CSafeIOException e) {
++		AddLogLineN(e.what());
+ 	}
+ 
+ 	// Load old values from config
diff --git a/debian/patches/series b/debian/patches/series
index f473898..ad39f0c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ fallocate.diff
 version_check.diff
 libupnp-fix-publisherurl.patch
 gcc_4.7.diff
+handle_empty_statistics_file.patch

-- 
Git repository for pkg-amule



More information about the Pkg-amule-commits mailing list