From 520931867ee2fac8415a624204414d3b62550996 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 29 Jun 2016 14:57:00 +0200 Subject: if reading of autobit state failed, let write fail If we can't read the old file we can't just move forward as that would discard potentially discard old data (especially other fields). We let it fail only after we are done writing the new file so a user has the chance to look into and merge the new data (which is otherwise discarded). --- apt-pkg/depcache.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index f38f956e4..01ae66ed2 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -327,6 +327,11 @@ bool pkgDepCache::writeStateFile(OpProgress * const /*prog*/, bool const Install return false; } } + if (StateFile.Failed()) + { + OutFile.OpFail(); + return false; + } if (OutFile.Close() == false) return false; chmod(state.c_str(), 0644); -- cgit v1.2.3