shithub: gefs

Download patch

ref: a6edc1bec0e8930d6f5c61a67330b9f966e0570e
parent: 0630e7982513a669eeaa8a7429372ee5338e2d67
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Apr 29 19:43:39 EDT 2023

check: improve robustness for verification

--- a/check.c
+++ b/check.c
@@ -55,7 +55,7 @@
 	getval(b, 0, &x);
 	if(lo && keycmp(lo, &x) > 0){
 		fprint(fd, "out of range keys %P != %P\n", lo, &x);
-		showblk(2, b, "out of range", 1);
+		showblk(fd, b, "out of range", 1);
 		fail++;
 	}
 	for(i = 1; i < b->nval; i++){
@@ -214,10 +214,11 @@
 			ok = 0;
 			break;
 		}
-		if((b = getroot(t, &height)) != nil){
-			if(badtree(fd, b, height-1, nil, 0))
-				ok = 0;
-			dropblk(b);
+		if((b = getroot(t, &height)) == nil){
+			fprint(fd, "unable to get root %B\n", t->bp);
+			ok = 0;
+			if((b = getblk(t->bp, GBnochk)) != nil)
+				showblk(fd, b, "corrupt", 0);
 			continue;
 		}
 		if(badtree(fd, b, height-1, nil, 0))