From: Vladimír Čunát Date: Mon, 11 Feb 2019 11:53:01 +0000 (+0100) Subject: daemon/bindings: nitpicks fixed during MR review X-Git-Tag: v4.0.0~38^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f283f72958886e98ddbf73a62889c2b4ed829ca4;p=thirdparty%2Fknot-resolver.git daemon/bindings: nitpicks fixed during MR review --- diff --git a/daemon/bindings/cache.c b/daemon/bindings/cache.c index 79f8d2ef3..120679983 100644 --- a/daemon/bindings/cache.c +++ b/daemon/bindings/cache.c @@ -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) ">'"); diff --git a/daemon/bindings/net.c b/daemon/bindings/net.c index 45c44ea29..373e7a863 100644 --- a/daemon/bindings/net.c +++ b/daemon/bindings/net.c @@ -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) {