Skip to content
Snippets Groups Projects
Verified Commit f283f729 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

daemon/bindings: nitpicks fixed during MR review

parent 5b73673a
No related branches found
No related tags found
1 merge request!768smaller changes, mainly around lua error handling
Pipeline #45223 failed
......@@ -126,11 +126,11 @@ static int cache_max_ttl(lua_State *L)
int n = lua_gettop(L);
if (n > 0) {
if (!lua_isnumber(L, 1))
if (!lua_isnumber(L, 1) || n > 1)
lua_error_p(L, "expected 'max_ttl(number ttl)'");
uint32_t min = cache->ttl_min;
int64_t ttl = lua_tointeger(L, 1);
if (ttl < 0 || ttl < min || ttl > UINT32_MAX) {
if (ttl < 1 || ttl < min || ttl > UINT32_MAX) {
lua_error_p(L,
"max_ttl must be larger than minimum TTL, and in range <1, "
STR(UINT32_MAX) ">'");
......
......@@ -489,8 +489,8 @@ static int net_tls_padding(lua_State *L)
const char *errstr = "net.tls_padding parameter has to be true, false,"
" or a number between <0, " STR(MAX_TLS_PADDING) ">";
if ((lua_gettop(L) != 1))
lua_error_p(L, "net.tls_padding takes one parameter: (\"padding\")");
if (lua_gettop(L) != 1)
lua_error_p(L, "%s", errstr);
if (lua_isboolean(L, 1)) {
bool x = lua_toboolean(L, 1);
if (x) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment