This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
PATCH: waitpid in natPosixProcess.cc
- From: Andrew Haley <aph at redhat dot com>
- To: Casey Marshall <csm at gnu dot org>
- Cc: java-patches at gcc dot gnu dot org
- Date: Wed, 21 Apr 2004 09:26:35 +0100
- Subject: PATCH: waitpid in natPosixProcess.cc
- References: <87y8oqtdv6.fsf@gnu.org>
Casey Marshall writes:
> Attached is a simple patch that invokes waitpid if either the process
> is destroy()ed or the C call to exec() fails.
>
> This prevents Runtime.exec from spawning zombie processes if the given
> command cannot be found, or if the process is killed. I wasn't sure if
> it was appropriate to call waitFor instead, but (AFAIK) calling
> waitpid in these two spots is safe.
I think this is probably wrong, because you don't set hasExited in the
Process. With this patch, a subsequent call to Process::destroy will
cause some other process that coincidentally has the same PID to be
killed.
Andrew.