This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: Add wrappers for ExitProcess, TerminateProcess
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- Cc: cygwin-patches at cygwin dot com
- Date: Mon, 05 Oct 2009 20:39:34 +0100
- Subject: Re: Add wrappers for ExitProcess, TerminateProcess
- References: <4ACA4323.5080103@cwilson.fastmail.fm> <4ACA47AF.7070703@gmail.com>
Dave Korn wrote:
> Heh. I see what you did there!
As to the actual patch itself, it looks sane (just reading it by eye, I
haven't tested it), and the design motivation seems reasonable.
> @@ -136,11 +136,19 @@ status_exit (DWORD x)
>
> # define self (*this)
> void
> +pinfo::set_exit_code (DWORD x)
> +{
> + extern int sigExeced;
> + if (x >= 0xc0000000UL)
> + x = status_exit (x);
> + self->exitcode = EXITCODE_SET | (sigExeced ?: (x & 0xff) << 8);
> +}
> +
> +void
> pinfo::maybe_set_exit_code_from_windows ()
> {
> DWORD x = 0xdeadbeef;
> DWORD oexitcode = self->exitcode;
> - extern int sigExeced;
File-local extern declarations are pure evil, let alone function-local ones.
Why not fix this badness while you're touching it anyway?
cheers,
DaveK