https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=048f28bfe4a86fde44759ccec34e8ac7de56eebe
commit 048f28bfe4a86fde44759ccec34e8ac7de56eebe Author: Corinna Vinschen <[email protected]> Date: Tue Mar 12 11:17:11 2019 +0100 Cygwin: proc: return more useful cmdline Creating /proc/<PID>/cmdline requires permissions to communicate with the target process via its signal pipe. If that fails, the output is "<defunct>" which doesn't make sense most of the time. Rather, call format_process_exename in this case to get more useful process name info, albeit not the full cmdline. Signed-off-by: Corinna Vinschen <[email protected]> Diff: --- winsup/cygwin/fhandler_process.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 29b8c59..06325ca 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -519,12 +519,9 @@ format_process_cmdline (void *data, char *&destbuf) destbuf = NULL; } destbuf = p ? p->cmdline (fs) : NULL; - if (!destbuf || !*destbuf) - { - destbuf = cstrdup ("<defunct>"); - fs = strlen (destbuf) + 1; - } - return fs; + if (destbuf && *destbuf) + return fs; + return format_process_exename (data, destbuf); } static off_t
