Fix crash if --embed is used more than once

This commit is contained in:
James McCoy
2018-10-01 22:58:47 -04:00
parent 65206714bc
commit eb7b2c7912
2 changed files with 14 additions and 4 deletions

View File

@@ -258,6 +258,14 @@ int main(int argc, char **argv)
// Process the command line arguments. File names are put in the global
// argument list "global_alist".
command_line_scan(&params);
if (embedded_mode) {
const char *err;
if (!channel_from_stdio(true, CALLBACK_READER_INIT, &err)) {
abort();
}
}
server_init(params.listen_addr);
if (GARGCOUNT > 0) {
@@ -848,10 +856,6 @@ static void command_line_scan(mparm_T *parmp)
headless_mode = true;
} else if (STRICMP(argv[0] + argv_idx, "embed") == 0) {
embedded_mode = true;
const char *err;
if (!channel_from_stdio(true, CALLBACK_READER_INIT, &err)) {
abort();
}
} else if (STRNICMP(argv[0] + argv_idx, "listen", 6) == 0) {
want_argument = true;
argv_idx += 6;