From 9726cf82b89746a71b9d6dc8ebf473891c4091c1 Mon Sep 17 00:00:00 2001 From: Bram Stolk Date: Wed, 12 May 2021 08:19:05 -0700 Subject: [PATCH] Complain about kernel version if format of file is not understood. --- diskgraph.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/diskgraph.c b/diskgraph.c index a9a3a55..6a4e7e5 100644 --- a/diskgraph.c +++ b/diskgraph.c @@ -247,7 +247,17 @@ void get_stats( char* fname ) "%u %u %u %u %u %u %u %u %u %u %u %u %u %u %u", v+0,v+1,v+2,v+3,v+4,v+5,v+6,v+7,v+8,v+9,v+10,v+11,v+12,v+13,v+14 ); - assert( numv == 15 ); + if ( numv != 15 ) + { + fprintf + ( + stderr, + "Did not find all the fields in %s that were expected.\n" + "Most likely, your kernel is too old to work with diskgraph.\n", + fname + ); + exit(3); + } uint32_t rd = v[2]; // number of sectors read. uint32_t wr = v[6]; // number of sectors written.