The 'Program name' part is fetched from /proc/<pid>/cmdline, then mangled
before presentation.  Mangling is done in netstat.c, function 'dir_act'.
The function assumes cmdline is a file path and extracts the basename.
Obviously that assumption is not always correct.  It's not unusual a
cmdline looks like this:

        sshd: foo@pts/48

or like this:

        sshd: foo [priv]

Function 'bb_basename' uses strrchr everything up to and including the
last occurrence och character '/'.  The result is (see first example
above):

        PID/Program name
        12345/48

or (second example):

        PID/Program name
        12345/sshd: foo [priv]

Neither is desirable.
I'd like to propose a different way to do that:

1. strip everything after and including the first whitespace character
2. maybe remove even odd ':' character at the end of the string
3. call bb_basename after that

Output would then look like:

        PID/Program name
        12345/sshd

which is what one would expect.

Thoughts?


Cheers,

-- 
Cristian
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to