]> granicus.if.org Git - procps-ng/commit
top: a small safeguard added to the ATEOJ_RPTHSH logic
authorJim Warner <james.warner@comcast.net>
Mon, 19 Oct 2020 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Sat, 24 Oct 2020 07:29:13 +0000 (18:29 +1100)
commit2a5b8658d2ea5f6edc994212ba3a44df4645942f
tree24c470d05401454e365db9c0c80636eb628ba368
parentcb134481791aadbbbf548b5bb3996f174b543e65
top: a small safeguard added to the ATEOJ_RPTHSH logic

If a hash results report was output (via ATEOJ_RPTHSH)
a portion is devoted to occupied table entries ordered
by depth. There is a possibility that some depths will
not be found among existing occupied table entries and
to avoid any confusion probably should not be printed.

[ to illustrate the potential for confusion prior to ]
[ this patch, force a very small table size (like 8) ]
[ and then arrange to trigger the end-of-job report. ]

So this patch ensures only 'in use' entries are shown.

[ admittedly, all of the remaining logic in the loop ]
[ could/should be subordinate to this new 'if' test, ]
[ but we will keep the change to a minimum. besides, ]
[ there's no harm subtracting/adding a zero numdepth ]
[ especially since the chance of a zero is very low. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c