diff options
author | Andris Zeila <andris.zeila@zabbix.com> | 2022-01-07 16:27:30 +0300 |
---|---|---|
committer | Andris Zeila <andris.zeila@zabbix.com> | 2022-01-07 16:27:30 +0300 |
commit | 7a10266e4c6334d7d1513aa986923dc36f16c4b1 (patch) | |
tree | 62384d130c5146a0b1d96599cebd6f0175620002 /src/libs | |
parent | ad0f5b29062d142ebd5a1ad848ae8d6cf1f5ce3f (diff) |
.......PS. [ZBX-20405] improved embeded script timeout checking macro
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/zbxembed/embed.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libs/zbxembed/embed.h b/src/libs/zbxembed/embed.h index 3d05530a971..e9db0114b1c 100644 --- a/src/libs/zbxembed/embed.h +++ b/src/libs/zbxembed/embed.h @@ -26,12 +26,12 @@ #define ZBX_ES_LOG_MEMORY_LIMIT (ZBX_MEBIBYTE * 8) /* check (and fail) if timeout was exceeded in C function */ -#define ZBX_ES_CHECK_TIMEOUT(env) \ +#define ZBX_ES_CHECK_TIMEOUT(ctx, env) \ do { \ zbx_uint64_t elapsed_ms; \ elapsed_ms = zbx_get_duration_ms(&env->start_time); \ - if (elapsed_ms >= env->timeout * 1000) \ - return duk_throw(ctx); \ + if (elapsed_ms >= (zbx_uint64_t)env->timeout * 1000) \ + return duk_error(ctx, DUK_RET_TYPE_ERROR, "script execution timeout occurred"); \ } \ while (0); |