diff options
author | Rob Landley <rob@landley.net> | 2023-04-11 14:35:03 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2023-04-11 14:35:03 -0500 |
commit | c8f758c734506d6131c2eefdb5ce2618d4b2b1d2 (patch) | |
tree | 13a2ca91b0fb21841e2d78fd5e195184e554ba9f | |
parent | 25d72febcc2fbb0cb3bfb872557a939c69782390 (diff) | |
download | toybox-c8f758c734506d6131c2eefdb5ce2618d4b2b1d2.tar.gz |
Two small fixes from zhmars.
-rw-r--r-- | toys/other/vmstat.c | 6 |
1 files 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<sizeof(lengths); i++) { - char order[] = {9, 10, 15, 11, 12, 13, 19, 20, 17, 18, 6, 8, 0, 2, 3, 4}; + char order[] = {9, 10, 15, 11, 12, 13, 19, 20, 17, 18, 7, 8, 0, 2, 3, 4}; unsigned long long out = ptr[order[i]]; int len; |