Skip to contentSkip to conversation

verify_blkparse: inform on bad line, report line no

PATCH In review Steffen Maier 1 participant 1 message Apr 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 24/31 verify_blkparse: inform on bad line, report line no

---
 verify_blkparse.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
verify_blkparse.c +10 -2
index 3f3e92a563c9..97dbc2970dee 100644
@@ -48,12 +48,18 @@ int main(int argc, char *argv[])
 	alias = nr = 0;
 	total_entries = 0;
 	while ((p = fgets(line, sizeof(line), f)) != NULL) {
-		if (sscanf(p, "%3d,%3d %5d %8d %lf", &major, &minor, &cpu, &seq, &this_time) != 5)
+		if (sscanf(p, "%3d,%3d %5d %8d %lf",
+			   &major, &minor, &cpu, &seq, &this_time) != 5) {
+			fprintf(stdout, "unrecognized line, aborting\n");
+			fprintf(stdout, "this (line no %llu): %s",
+				total_entries + 1, p);
 			break;
+		}
 
 		if (this_time < last_time) {
 			fprintf(stdout, "last: %s", last_line);
-			fprintf(stdout, "this: %s", p);
+			fprintf(stdout, "this (line no %llu): %s",
+				total_entries + 1, p);
 			nr++;
 		}
 
@@ -66,6 +72,8 @@ int main(int argc, char *argv[])
 
 		if (last_seq[cpu] = seq) {
 			fprintf(stdout, "alias on sequence %u\n", seq);
+			fprintf(stdout, "this (line no %llu): %s",
+				total_entries + 1, p);
 			alias++;
 		}
 
Signature · 1 line
2.14.2