shithub: sce

Download patch

ref: 3f13cbdf07b968edf21e58ebe71884f7072fb816
parent: 57d547f1bbfca33c49e10bcf4d55e6fba2e47067
author: qwx <[email protected]>
date: Mon Jun 28 18:29:39 EDT 2021

fs: loaddb: ignore unknown records

--- a/fs.c
+++ b/fs.c
@@ -513,8 +513,10 @@
 		for(t=table; t<table+nelem(table); t++)
 			if(strcmp(s, t->name) == 0)
 				break;
-		if(t == table + nelem(table))
-			sysfatal("loaddb: unknown table %s", s);
+		if(t == table + nelem(table)){
+			fprint(2, "loaddb: unknown table %s\n", s);
+			goto skip;
+		}
 		if(t->nrow != nil)
 			(*t->nrow)++;
 	skip:
@@ -530,6 +532,8 @@
 		for(t=table; t<table+nelem(table); t++)
 			if(strcmp(s, t->name) == 0)
 				break;
+		if(t == table + nelem(table))
+			goto next;
 		n = getcsvfields(p+1, fld, nelem(fld));
 		if(n != t->ncol && t->ncol >= 0)
 			sysfatal("loaddb: invalid row length %d for %s record %s", n, s, fld[0]);