From c8f758c734506d6131c2eefdb5ce2618d4b2b1d2 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 11 Apr 2023 14:35:03 -0500 Subject: [PATCH] Two small fixes from zhmars. --- toys/other/vmstat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toys/other/vmstat.c b/toys/other/vmstat.c index 4ab5610a..ebe5399e 100644 --- a/toys/other/vmstat.c +++ b/toys/other/vmstat.c @@ -65,7 +65,7 @@ static void get_vmstat_proc(struct vmstat_proc *vmsp) file = xreadfile(name = vmstuff[i], 0, 0); continue; - } else if (!(p = strafter(file, vmstuff[i]))) { + } else if (file && !(p = strafter(file, vmstuff[i]))) { free(file); file = 0; } @@ -127,10 +127,10 @@ void vmstat_main(void) for (i = total_hz = 0; i<4; i++) total_hz += ptr[i+!!i] - oldptr[i+!!i]; // Output values in order[]: running, blocked, swaptotal, memfree, buffers, - // cache, swap_in, swap_out, io_in, io_out, sirq, ctxt, user, sys, idle,wait + // cache, swap_in, swap_out, io_in, io_out, intr, ctxt, user, sys, idle,wait for (i=0; i