* ps.cc (main): Don't overwrite process name, just attach <defunct>

to it for zombie processes.
This commit is contained in:
Corinna Vinschen 2011-08-10 19:52:41 +00:00
parent d10f0e106e
commit 56a85b9cea
2 changed files with 10 additions and 5 deletions

View File

@ -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.

View File

@ -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)
{