From 6dbf9cfec1579f1cc4fe106b9e2c4ca21ecc8532 Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Tue, 19 Nov 2019 19:19:53 +0300 Subject: [PATCH] Fixed handling of "init" flag in njs_vm_create(). --- src/njs_shell.c | 2 +- src/njs_vm.c | 2 +- src/test/njs_interactive_test.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/njs_shell.c b/src/njs_shell.c index d0428ca6..3a89ba55 100644 --- a/src/njs_shell.c +++ b/src/njs_shell.c @@ -243,7 +243,7 @@ main(int argc, char **argv) vm_options.file.start = (u_char *) opts.file; vm_options.file.length = njs_strlen(opts.file); - vm_options.init = !opts.interactive; + vm_options.init = 1; vm_options.accumulative = opts.interactive; vm_options.disassemble = opts.disassemble; vm_options.backtrace = 1; diff --git a/src/njs_vm.c b/src/njs_vm.c index c2c948a7..d4c56358 100644 --- a/src/njs_vm.c +++ b/src/njs_vm.c @@ -85,7 +85,7 @@ njs_vm_create(njs_vm_opt_t *options) vm->debug = debug; } - if (options->accumulative) { + if (options->init) { ret = njs_vm_init(vm); if (njs_slow_path(ret != NJS_OK)) { return NULL; diff --git a/src/test/njs_interactive_test.c b/src/test/njs_interactive_test.c index 75bf97bd..931b7997 100644 --- a/src/test/njs_interactive_test.c +++ b/src/test/njs_interactive_test.c @@ -289,6 +289,7 @@ njs_interactive_test(njs_bool_t verbose) njs_memzero(&options, sizeof(njs_vm_opt_t)); + options.init = 1; options.accumulative = 1; options.backtrace = 1; -- 2.47.3