[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Crash with recursive make

From: grischka
Subject: RE: Crash with recursive make
Date: Thu, 12 Oct 2006 19:43:43 +0200

John Hall wrote:

The call to CreatePipe succeeds, but the second call to _open_osfhandle
fails, with EBADF and ERROR_INVALID_HANDLE. The code does not currently
check the return code to either of the calls to _open_osfhandle.

I'm not sure why it should fail - perhaps cat closes its stdin or has
already exited - but given this is possible perhaps my fix is the
correct one.

I dont think other processes can ever close make's handles. This would be no fun with programming if you could not rely on a handle being valid until it's closed from within the program that holds it. So I would think that make closes the handle itself, anyway somewhere after the call to CreatePipe and before the call to _open_osfhandle.
I would suggest, therefore, that the version of
'close' in the  C runtime shipped with VS 2005 is stricter about
checking its arguments, which is why I see it and you don't.

MS calls it "Security Enhancements in the CRT". The functions have
built-in asserts on the parameters, like if you wrote: assert(fd >= 0); close(fd); The assert when it fails calls a hook and the default hook function raises an exception.

--- grischka

reply via email to

[Prev in Thread] Current Thread [Next in Thread]