main: Temporary fix assertion error

This variant uses `fdopen()` which is not standard, but it fixes problem on my 
system. In next commit `scriptin` will use `FileDescriptor*` from os/fileio in 
place of `FILE*`.
This commit is contained in:
ZyX
2017-03-19 16:09:48 +03:00
parent d2268d5ebb
commit fdfa1ed578
4 changed files with 90 additions and 1 deletions

View File

@@ -1057,7 +1057,9 @@ scripterror:
mch_exit(2);
}
if (STRCMP(argv[0], "-") == 0) {
scriptin[0] = stdin;
const int stdin_dup_fd = os_dup(STDIN_FILENO);
FILE *const stdin_dup = fdopen(stdin_dup_fd, "r");
scriptin[0] = stdin_dup;
} else if ((scriptin[0] = mch_fopen(argv[0], READBIN)) == NULL) {
mch_errmsg(_("Cannot open for reading: \""));
mch_errmsg(argv[0]);