From 151869b449d49155ea57a2f47579930dca71ea4a Mon Sep 17 00:00:00 2001 From: upstream svn Date: Sun, 4 Nov 2012 16:32:47 +0000 Subject: [PATCH] Delete broken seeds files --- .svn-revision | 2 +- src/PartFile.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.svn-revision b/.svn-revision index a7ad0aaa..484f86c4 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -10801 +10802 diff --git a/src/PartFile.cpp b/src/PartFile.cpp index 83ba869c..3d6a9e3c 100644 --- a/src/PartFile.cpp +++ b/src/PartFile.cpp @@ -1046,21 +1046,16 @@ void CPartFile::LoadSourceSeeds() CFile file(seedsPath, CFile::read); if (!file.IsOpened()) { - AddLogLineN(CFormat( _("Partfile %s (%s) has no seeds file") ) + // Exists but can't be opened. Should not happen. Probably permission problem, try to remove it. + AddLogLineN(CFormat( _("Can't read seeds file for Partfile %s (%s)") ) % m_partmetfilename % GetFileName() ); + CPath::RemoveFile(seedsPath); return; } - + bool badSeedsFile = false; try { - if (file.GetLength() <= 1) { - AddLogLineN(CFormat( _("Partfile %s (%s) has a void seeds file") ) - % m_partmetfilename - % GetFileName() ); - return; - } - uint8 src_count = file.ReadUInt8(); bool bUseSX2Format = (src_count == 0); @@ -1115,9 +1110,14 @@ void CPartFile::LoadSourceSeeds() % m_partmetfilename % GetFileName() % e.what() ); + badSeedsFile = true; } file.Close(); + if (badSeedsFile) { + // If we got an exception reading it remove it. + CPath::RemoveFile(seedsPath); + } } void CPartFile::PartFileHashFinished(CKnownFile* result) -- 2.11.4.GIT