summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 58df084..65b22aa 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -197,8 +197,15 @@ Py_Main(argc, argv)
exit(2);
}
else if (skipfirstline) {
- char line[256];
- fgets(line, sizeof line, fp);
+ int ch;
+ /* Push back first newline so line numbers
+ remain the same */
+ while ((ch = getc(fp)) != EOF) {
+ if (ch == '\n') {
+ (void)ungetc(ch, fp);
+ break;
+ }
+ }
}
}
}