]> git.saurik.com Git - apt.git/commitdiff
if reading of autobit state failed, let write fail
authorDavid Kalnischkies <david@kalnischkies.de>
Wed, 29 Jun 2016 12:57:00 +0000 (14:57 +0200)
committerJulian Andres Klode <jak@debian.org>
Wed, 31 Aug 2016 11:15:23 +0000 (13:15 +0200)
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).

(cherry picked from commit 520931867ee2fac8415a624204414d3b62550996)

apt-pkg/depcache.cc

index aa434e99c73683cdff905b9c643e1c6389cdee3c..5af94a58b0c1fdcbbd31c39492db81d76715d6f0 100644 (file)
@@ -326,6 +326,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);