summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libps/procstat.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libps/procstat.c b/libps/procstat.c
index 8060faf6..c8858dee 100644
--- a/libps/procstat.c
+++ b/libps/procstat.c
@@ -457,7 +457,11 @@ get_thread_wait (char *waits, size_t waits_len, unsigned n)
if (wait >= waits + waits_len)
wait = 0;
else
- wait = memchr (wait, '\0', wait + waits_len - waits);
+ {
+ wait = memchr (wait, '\0', waits_len - (wait - waits));
+ if (wait)
+ wait++;
+ }
return wait;
}