aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2023-04-11 14:35:03 -0500
committerRob Landley <rob@landley.net>2023-04-11 14:35:03 -0500
commitc8f758c734506d6131c2eefdb5ce2618d4b2b1d2 (patch)
tree13a2ca91b0fb21841e2d78fd5e195184e554ba9f
parent25d72febcc2fbb0cb3bfb872557a939c69782390 (diff)
downloadtoybox-c8f758c734506d6131c2eefdb5ce2618d4b2b1d2.tar.gz
Two small fixes from zhmars.
-rw-r--r--toys/other/vmstat.c6
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;