]> 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)
committerDavid Kalnischkies <david@kalnischkies.de>
Wed, 29 Jun 2016 13:01:39 +0000 (15:01 +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).

apt-pkg/depcache.cc

index f38f956e48c7b110c64ee91f229a7f1e0f021186..01ae66ed21f06b283246467fe165c08df47306b4 100644 (file)
@@ -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);