Commit b49561d8 authored by Russ Cox's avatar Russ Cox

gc: graceful exit on seg fault

R=ken2
CC=golang-dev
https://golang.org/cl/1882043
parent a59e113f
...@@ -90,6 +90,18 @@ usage(void) ...@@ -90,6 +90,18 @@ usage(void)
exit(0); 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 int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
...@@ -97,6 +109,9 @@ main(int argc, char *argv[]) ...@@ -97,6 +109,9 @@ main(int argc, char *argv[])
NodeList *l; NodeList *l;
char *p; char *p;
signal(SIGBUS, fault);
signal(SIGSEGV, fault);
localpkg = mkpkg(strlit("")); localpkg = mkpkg(strlit(""));
localpkg->prefix = "\"\""; localpkg->prefix = "\"\"";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment