1
0
mirror of https://github.com/golang/go synced 2024-11-21 19:34:46 -07:00

gc: graceful exit on seg fault

R=ken2
CC=golang-dev
https://golang.org/cl/1882043
This commit is contained in:
Russ Cox 2010-07-26 16:52:51 -07:00
parent a59e113fcb
commit b49561d884

View File

@ -90,12 +90,27 @@ usage(void)
exit(0);
}
void
fault(int s)
{
// If we've already complained about things
// in the program, don't bother complaining
// about the seg fault too; let the user clean up
// the code and try again.
if(nerrors > 0)
errorexit();
fatal("fault");
}
int
main(int argc, char *argv[])
{
int i, c;
NodeList *l;
char *p;
signal(SIGBUS, fault);
signal(SIGSEGV, fault);
localpkg = mkpkg(strlit(""));
localpkg->prefix = "\"\"";