From 048f28bfe4a86fde44759ccec34e8ac7de56eebe Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 12 Mar 2019 11:17:11 +0100 Subject: [PATCH] Cygwin: proc: return more useful cmdline Creating /proc//cmdline requires permissions to communicate with the target process via its signal pipe. If that fails, the output is "" 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 --- 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 29b8c5934..06325caf1 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 (""); - fs = strlen (destbuf) + 1; - } - return fs; + if (destbuf && *destbuf) + return fs; + return format_process_exename (data, destbuf); } static off_t