aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/vdb_unmerger.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-10 01:54:02 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-10 01:54:02 +0000
commitadf7d7f87e7701dd5dee402ac396c231489fde1d (patch)
tree4c0adfbef2d913d331182c2379b304628826afbf /paludis/repositories/e/vdb_unmerger.cc
parent58d9dd98d1bdfa81b810b9742c3f4cd93f6a5f8f (diff)
parent8772b7a5c74c3254a53e70a922e9e0a2bc1c09c3 (diff)
downloadpaludis-adf7d7f87e7701dd5dee402ac396c231489fde1d.tar.gz
paludis-adf7d7f87e7701dd5dee402ac396c231489fde1d.tar.xz
Merge commit 'git-pioto-org/master' into logging
Diffstat (limited to 'paludis/repositories/e/vdb_unmerger.cc')
-rw-r--r--paludis/repositories/e/vdb_unmerger.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc
index cbadede31..c5d1ef0b9 100644
--- a/paludis/repositories/e/vdb_unmerger.cc
+++ b/paludis/repositories/e/vdb_unmerger.cc
@@ -40,11 +40,11 @@ using namespace paludis;
#include <paludis/util/strip.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/output_manager.hh>
+#include <paludis/util/safe_ifstream.hh>
#include <list>
#include <map>
#include <vector>
-#include <fstream>
namespace paludis
{
@@ -205,7 +205,7 @@ VDBUnmerger::make_tidy(const FSEntry & f) const
void
VDBUnmerger::populate_unmerge_set()
{
- std::ifstream c(stringify(_imp->options.contents_file()).c_str());
+ SafeIFStream c(_imp->options.contents_file());
if (! c)
throw VDBUnmergerError("Cannot read '" + stringify(_imp->options.contents_file()) + "'");
@@ -266,19 +266,22 @@ VDBUnmerger::check_file(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo>
display("--- [!time] " + stringify(f));
else
{
- std::ifstream md5_file(stringify(_imp->options.root() / f).c_str());
- if (! md5_file)
+ try
+ {
+ SafeIFStream md5_file(_imp->options.root() / f);
+ if (MD5(md5_file).hexsum() != fie->_md5sum)
+ display("--- [!md5 ] " + stringify(f));
+ else if (config_protected(_imp->options.root() / f))
+ display("--- [cfgpr] " + stringify(f));
+ else
+ return true;
+ }
+ catch (const SafeIFStreamError &)
{
Log::get_instance()->message("e.vdb.contents.md5_failed", ll_warning, lc_no_context)
<< "Cannot get md5 for '" << (_imp->options.root() / f) << "'";
display("--- [!md5?] " + stringify(f));
}
- else if (MD5(md5_file).hexsum() != fie->_md5sum)
- display("--- [!md5 ] " + stringify(f));
- else if (config_protected(_imp->options.root() / f))
- display("--- [cfgpr] " + stringify(f));
- else
- return true;
}
return false;