make old deps format migration actually work
authorEvan Martin <martine@danga.com>
Tue, 8 Jan 2013 16:17:12 +0000 (08:17 -0800)
committerEvan Martin <martine@danga.com>
Mon, 8 Apr 2013 22:01:42 +0000 (15:01 -0700)
src/deps_log.cc

index 5706be4..081fcf0 100644 (file)
@@ -128,12 +128,11 @@ bool DepsLog::Load(const string& path, State* state, string* err) {
     return false;
   }
   int version = 0;
-  if (sscanf(buf, kFileSignature, &version) != 1) {
-    *err = "unable to read file signature";
-    return false;
-  }
+  sscanf(buf, kFileSignature, &version);
   if (version != kCurrentVersion) {
-    *err = "bad deps log version; starting over";
+    *err = "bad deps log signature or version; starting over";
+    fclose(f);
+    unlink(path.c_str());
     // Don't report this as a failure.  An empty deps log will cause
     // us to rebuild the outputs anyway.
     return true;