From 70ed51a303870952178b4acf11fd1954e2665127 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Wed, 7 Feb 2018 23:16:37 +0100 Subject: [PATCH] linux/LinuxProcessList: fix reading of number of read syscalls of process The "if" tests if the character at index "5" is 'r', as a first quick check. However at index "5" will always be a colon ":". This patch fixes the off-by-one error. htop now shows proper values in the RD_SYSC column. Signed-off-by: Marc Kleine-Budde --- linux/LinuxProcessList.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index 6f2631af..23077025 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -436,7 +436,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna } break; case 's': - if (line[5] == 'r' && strncmp(line+1, "yscr: ", 6) == 0) { + if (line[4] == 'r' && strncmp(line+1, "yscr: ", 6) == 0) { process->io_syscr = strtoull(line+7, NULL, 10); } else if (strncmp(line+1, "yscw: ", 6) == 0) { process->io_syscw = strtoull(line+7, NULL, 10);