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>2011-08-10 23:52:41 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-08-10 23:52:41 +0400
commit56a85b9ceacc14be33d83b40ee1cab94e71b5f43 (patch)
tree32cb6355f3f6a38fa3302d05d3c42067a9bf5193
parentd10f0e106e5bbc20d84722e9d45a6e8623d96e2d (diff)
* ps.cc (main): Don't overwrite process name, just attach <defunct>
to it for zombie processes.
-rw-r--r--winsup/utils/ChangeLog5
-rw-r--r--winsup/utils/ps.cc10
2 files changed, 10 insertions, 5 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index c1714fa22..1b95df500 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-10 Corinna Vinschen <corinna@vinschen.de>
+
+ * ps.cc (main): Don't overwrite process name, just attach <defunct>
+ to it for zombie processes.
+
2011-07-19 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* Makefile.in (CYGWIN_BINS): Add getconf.
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc
index fe8138dc1..3a55f497a 100644
--- a/winsup/utils/ps.cc
+++ b/winsup/utils/ps.cc
@@ -1,7 +1,7 @@
/* ps.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2008, 2009, 2010 Red Hat, Inc.
+ 2008, 2009, 2010, 2011 Red Hat, Inc.
This file is part of Cygwin.
@@ -397,10 +397,8 @@ main (int argc, char *argv[])
/* Maximum possible path length under NT. There's no official define
for that value. */
- char pname[NT_MAX_PATH];
- if (p->process_state & PID_EXITED || (p->exitcode & ~0xffff))
- strcpy (pname, "<defunct>");
- else if (p->ppid)
+ char pname[NT_MAX_PATH + sizeof (" <defunct>")];
+ if (p->ppid)
{
char *s;
pname[0] = '\0';
@@ -413,6 +411,8 @@ main (int argc, char *argv[])
s = strchr (pname, '\0') - 4;
if (s > pname && strcasecmp (s, ".exe") == 0)
*s = '\0';
+ if (p->process_state & PID_EXITED || (p->exitcode & ~0xffff))
+ strcat (pname, " <defunct>");
}
else if (query == CW_GETPINFO_FULL)
{