[PATCH] Prevent restart of crashing non-Cygwin exe

Christian Franke Christian.Franke@t-online.de
Thu Jun 23 17:53:00 GMT 2011


If a non-Cygwin .exe started from a Cygwin shell window segfaults, 
Cygwin restarts the .exe 5 times.

Testcase:

$ cat crash.c
#include <stdio.h>

int main()
{
   printf("Hello, "); fflush(stdout);
   *(char *)0 = 42;
   printf("World\n");
   return 0;
}

$ gcc -o crash-c crash.c

$ ./crash-c
Hello, Segmentation fault (core dumped)

$ i686-w64-mingw32-gcc -o crash-w crash.c

$ ./crash-w
Hello, Hello, Hello, Hello, Hello, Hello,

(The repeated outputs are not be visible on 1.7.9-1 when shell runs in a 
Windows console without CYGWIN=tty)

The problem is that Cygwin retries CreateProcess() if process aborts 
with an unknown 0xc0000XXXX exit code also for non-Cygwin programs. The 
attached patch fixes this.

Christian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: spawn-no-retry.patch
Type: text/x-diff
Size: 1234 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20110623/7bd6a417/attachment.bin>


More information about the Cygwin-patches mailing list