Commit 516d9ef5 authored by Austin Clements's avatar Austin Clements

gc: abort if given an unknown debug (-d) flag

The check for unknown command line debug flags in gc was
incorrect: the loop over debugtab terminates when it reaches a
nil entry, but it was only reporting an error if the parser
had passed the last entry of debugtab (which it never did).
Fix this by reporting the usage error if the loop reaches a
nil entry.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/166110043
parent 182ec439
...@@ -344,8 +344,8 @@ main(int argc, char *argv[]) ...@@ -344,8 +344,8 @@ main(int argc, char *argv[])
break; break;
} }
} }
if(j == nelem(debugtab)) if(debugtab[j].name == nil)
fatal("unknown debug information -d '%s'\n", f[i]); sysfatal("unknown debug information -d '%s'\n", f[i]);
} }
} }
......
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