Skip to content

Commit 11f50eb

Browse files
committed
fix for null L flag
1 parent bc5c066 commit 11f50eb

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎lsofgraph.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,12 @@ def print_graph(procs, conns):
149149
print("\tp%s [ label = \"%s\\n%s %s\" fillcolor=%s ];" %
150150
(proc['p'], proc['n'], proc['p'], proc['L'], color))
151151
elif 'p' in proc:
152-
print("\tp%s [ label = \"%s\\n%s %s\" fillcolor=%s ];" %
152+
if 'L' in proc: # there could be no L flag if process running, but user was removed. lsof: no pwd entry for UID
153+
print("\tp%s [ label = \"%s\\n%s %s\" fillcolor=%s ];" %
153154
(proc['p'], proc['c'], proc['p'], proc['L'], color))
155+
else:
156+
print("\tp%s [ label = \"%s\\n%s %s\" fillcolor=%s ];" %
157+
(proc['p'], proc['c'], proc['p'], "no user", color))
154158
if 'R' in proc and proc['R'] in procs:
155159
proc_parent = procs[proc['R']]
156160
if proc_parent:

0 commit comments

Comments
 (0)