collectd: sqm_collect: optimise parent search

There can be only 1 parent process ID, so as soon as we find it, print
it and exit - there's no point searching any of the following lines

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
This commit is contained in:
Kevin Darbyshire-Bryant 2021-10-03 11:23:36 +01:00 committed by Kevin Darbyshire-Bryant
parent 6c73457c09
commit 9db12bbaff

View file

@ -100,7 +100,7 @@ process_qdisc() {
} }
# while not orphaned # while not orphaned
while [ $(awk '$1 ~ "^PPid:" {print $2}' /proc/$$/status) -ne 1 ] ; do while [ $(awk '$1 ~ "^PPid:" {print $2;exit}' /proc/$$/status) -ne 1 ] ; do
for ifc in "$@" ; do for ifc in "$@" ; do
process_qdisc "$ifc" process_qdisc "$ifc"
done done