Skip to content

Commit

Permalink
Fix recursion to exclude self node
Browse files Browse the repository at this point in the history
  • Loading branch information
rkervella committed Jul 11, 2023
1 parent c17c378 commit 853a7ab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/command/processes/pstree.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,16 @@ func (n *node) insert(proc *commonpb.Process) {
}

func (n *node) findParent(proc *commonpb.Process) *node {
// Empty node
if n.Value == nil {
return nil
}
// Skip self when called from reorder
// otherwise things might explode, see #1340
if n.Value.Pid == proc.Pid {
return nil
}
// Found parent
if n.Value.Pid == proc.Ppid {
return n
}
Expand Down

0 comments on commit 853a7ab

Please sign in to comment.