[njs] Avoiding modification of vm->retval in njs_add_event().
Dmitry Volyntsev
xeioex at nginx.com
Wed Dec 16 20:28:48 UTC 2020
details: https://hg.nginx.org/njs/rev/d8e94445f59b
branches:
changeset: 1583:d8e94445f59b
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Wed Dec 16 20:27:43 2020 +0000
description:
Avoiding modification of vm->retval in njs_add_event().
diffstat:
src/njs_event.c | 2 --
src/njs_timer.c | 6 +++++-
2 files changed, 5 insertions(+), 3 deletions(-)
diffs (28 lines):
diff -r 1f862b9dec16 -r d8e94445f59b src/njs_event.c
--- a/src/njs_event.c Wed Dec 16 20:27:31 2020 +0000
+++ b/src/njs_event.c Wed Dec 16 20:27:43 2020 +0000
@@ -62,8 +62,6 @@ njs_add_event(njs_vm_t *vm, njs_event_t
return NJS_ERROR;
}
- njs_set_number(&vm->retval, vm->event_id - 1);
-
return NJS_OK;
}
diff -r 1f862b9dec16 -r d8e94445f59b src/njs_timer.c
--- a/src/njs_timer.c Wed Dec 16 20:27:31 2020 +0000
+++ b/src/njs_timer.c Wed Dec 16 20:27:43 2020 +0000
@@ -68,7 +68,11 @@ njs_set_timer(njs_vm_t *vm, njs_value_t
return NJS_ERROR;
}
- return njs_add_event(vm, event);
+ if (njs_add_event(vm, event) == NJS_OK) {
+ njs_set_number(&vm->retval, vm->event_id - 1);
+ }
+
+ return NJS_OK;
memory_error:
More information about the nginx-devel
mailing list