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 <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2019-03-12 11:17:11 +01:00
parent d9f934c9e9
commit 048f28bfe4
1 changed files with 3 additions and 6 deletions

View File

@ -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;
}
if (destbuf && *destbuf)
return fs;
return format_process_exename (data, destbuf);
}
static off_t