Skip to content

Commit 50f5b1b

Browse files
committed
bugfix: the return value sizes of the C functions ngx_http_lua_init_by_inline and ngx_http_lua_init_by_file were wrong.
1 parent 8c74fb9 commit 50f5b1b

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/ngx_http_lua_initby.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "ngx_http_lua_util.h"
1414

1515

16-
int
16+
ngx_int_t
1717
ngx_http_lua_init_by_inline(ngx_log_t *log, ngx_http_lua_main_conf_t *lmcf,
1818
lua_State *L)
1919
{
@@ -27,7 +27,7 @@ ngx_http_lua_init_by_inline(ngx_log_t *log, ngx_http_lua_main_conf_t *lmcf,
2727
}
2828

2929

30-
int
30+
ngx_int_t
3131
ngx_http_lua_init_by_file(ngx_log_t *log, ngx_http_lua_main_conf_t *lmcf,
3232
lua_State *L)
3333
{

src/ngx_http_lua_initby.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
#include "ngx_http_lua_common.h"
1212

1313

14-
int ngx_http_lua_init_by_inline(ngx_log_t *log, ngx_http_lua_main_conf_t *lmcf,
15-
lua_State *L);
14+
ngx_int_t ngx_http_lua_init_by_inline(ngx_log_t *log,
15+
ngx_http_lua_main_conf_t *lmcf, lua_State *L);
1616

17-
int ngx_http_lua_init_by_file(ngx_log_t *log, ngx_http_lua_main_conf_t *lmcf,
18-
lua_State *L);
17+
ngx_int_t ngx_http_lua_init_by_file(ngx_log_t *log,
18+
ngx_http_lua_main_conf_t *lmcf, lua_State *L);
1919

2020

2121
#endif /* _NGX_HTTP_LUA_INITBY_H_INCLUDED_ */

src/ngx_http_lua_shdict.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ ngx_http_lua_shdict_init_zone(ngx_shm_zone_t *shm_zone, void *data)
103103
if (lmcf->shm_zones_inited == lmcf->shm_zones->nelts
104104
&& lmcf->init_handler)
105105
{
106-
if (lmcf->init_handler(ctx->log, lmcf, lmcf->lua) != 0) {
106+
if (lmcf->init_handler(ctx->log, lmcf, lmcf->lua) != NGX_OK) {
107107
/* an error happened */
108108
return NGX_ERROR;
109109
}

src/ngx_http_lua_util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3941,7 +3941,7 @@ ngx_http_lua_create_fake_request(ngx_connection_t *c)
39413941
}
39423942

39433943

3944-
int
3944+
ngx_int_t
39453945
ngx_http_lua_report(ngx_log_t *log, lua_State *L, int status)
39463946
{
39473947
const char *msg;
@@ -3960,7 +3960,7 @@ ngx_http_lua_report(ngx_log_t *log, lua_State *L, int status)
39603960
/* force a full garbage-collection cycle */
39613961
lua_gc(L, LUA_GCCOLLECT, 0);
39623962

3963-
return status;
3963+
return status == 0 ? NGX_OK : NGX_ERROR;
39643964
}
39653965

39663966

src/ngx_http_lua_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ ngx_connection_t * ngx_http_lua_create_fake_connection(void);
218218

219219
ngx_http_request_t * ngx_http_lua_create_fake_request(ngx_connection_t *c);
220220

221-
int ngx_http_lua_report(ngx_log_t *log, lua_State *L, int status);
221+
ngx_int_t ngx_http_lua_report(ngx_log_t *log, lua_State *L, int status);
222222

223223
int ngx_http_lua_do_call(ngx_log_t *log, lua_State *L);
224224

0 commit comments

Comments
 (0)