Hi Antony, Makes sense to me, however, what about TerminateProcess() in PHP_FUNCTION(proc_terminate)? As far as I recall (don't take my word for it), TerminateProcess() closes the handle for you, am I missing something? Can it break things on future releases of the OS?
Thanks! On Wed, 10 Nov 2004 19:08:18 +0300, Antony Dovgal <[EMAIL PROTECTED]> wrote: > On Wed, 10 Nov 2004 17:49:45 +0200 > > > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > Hi Guys, > > > > PHP_FUNCTION(proc_close) doesn't have a call to > > CloseHandle(proc->child), to close the process handle. > > This is causing a handle leak on Windows, and eventually brings the > > whole OS to it's knees. > > > > Here's the fixed code snippet (there's a DIFF at the end of the file): > > > > CloseHandle(proc->child);// ilya.1.0 20041110 > > First of all, this will work only under M$ systems and there are > plenty of others, that will be broken by your patch. > Second, handles are destroyed by proc_open_rsrc_dtor(), so I'd > propose the patch below instead: > > Index: proc_open.c > =================================================================== > RCS file: /repository/php-src/ext/standard/proc_open.c,v > retrieving revision 1.29 > diff -u -r1.29 proc_open.c > --- proc_open.c 29 Sep 2004 06:04:36 -0000 1.29 > +++ proc_open.c 10 Nov 2004 16:03:32 -0000 > @@ -219,6 +219,7 @@ > WaitForSingleObject(proc->child, INFINITE); > GetExitCodeProcess(proc->child, &wstatus); > FG(pclose_ret) = wstatus; > + CloseHandle(proc->child); > > #elif HAVE_SYS_WAIT_H > > -- > Wbr, > Antony Dovgal aka tony2001 > [EMAIL PROTECTED] || [EMAIL PROTECTED] > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php