Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2019-03-12 13:17:11 +0300
committerCorinna Vinschen <corinna@vinschen.de>2019-03-12 13:17:11 +0300
commit048f28bfe4a86fde44759ccec34e8ac7de56eebe (patch)
treeb9167833ddac3288a7aa3c24924accd3bf516463
parentd9f934c9e9ec5588e6c616e9c63dd348995dafa8 (diff)
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>
-rw-r--r--winsup/cygwin/fhandler_process.cc9
1 files 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 ("<defunct>");
- fs = strlen (destbuf) + 1;
- }
- return fs;
+ if (destbuf && *destbuf)
+ return fs;
+ return format_process_exename (data, destbuf);
}
static off_t