Fix a bug in this code that made it do the wrong thing when an option
was a single '-'. Thanks to Andrew Kuchling.
diff --git a/Python/getopt.c b/Python/getopt.c
index 80a00ef..91aaa28 100644
--- a/Python/getopt.c
+++ b/Python/getopt.c
@@ -62,7 +62,10 @@
opt_ptr = &argv[optind++][1];
}
- if ((ptr = strchr(optstring, option = *opt_ptr++)) == NULL) {
+ if ( (option = *opt_ptr++) == '\0')
+ return -1;
+
+ if ((ptr = strchr(optstring, option)) == NULL) {
if (opterr)
fprintf(stderr, "Unknown option: -%c\n", option);