]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/bindings: nitpicks fixed during MR review
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 11 Feb 2019 11:53:01 +0000 (12:53 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 11 Feb 2019 15:29:52 +0000 (16:29 +0100)
daemon/bindings/cache.c
daemon/bindings/net.c

index 79f8d2ef3a2ce5939af84e89cb94312b33bbe0c9..1206799838e02b2c5b85f3cd3784a28c6c526f1d 100644 (file)
@@ -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) ">'");
index 45c44ea298692d2ed2282502cd4dd42cec869c3f..373e7a863269c38835ca14c5c7e59ae4042c86ba 100644 (file)
@@ -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) {