Quellcode durchsuchen

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).
David Kalnischkies vor 10 Jahren
Ursprung
Commit
520931867e
1 geänderte Dateien mit 5 neuen und 0 gelöschten Zeilen
  1. 5 0
      apt-pkg/depcache.cc

+ 5 - 0
apt-pkg/depcache.cc

@@ -327,6 +327,11 @@ bool pkgDepCache::writeStateFile(OpProgress * const /*prog*/, bool const Install
 	    return false;
 	    return false;
       }
       }
    }
    }
+   if (StateFile.Failed())
+   {
+      OutFile.OpFail();
+      return false;
+   }
    if (OutFile.Close() == false)
    if (OutFile.Close() == false)
       return false;
       return false;
    chmod(state.c_str(), 0644);
    chmod(state.c_str(), 0644);