diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2022-07-30 12:00:40 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2022-07-30 12:00:40 -0300 |
commit | b9c6c96f800cfcc73d5767d66ffdfe235d5865ff (patch) | |
tree | 4e852c950f70880d52d8a8fb5a7396f9f7ef9a82 /config.c | |
parent | 0a1723376cfe7325521e4210e97aa4f2f5e45994 (diff) |
config: Use string instead of int in `check_port()`
oof, forgot that `config.port` is a string.
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -20,14 +20,15 @@ void cleanup_config(config *conf) { } int check_port(void *ctx, void *ret, const keyword *key, keyword_val val) { - if (key->type == TYPE_INT) { - if (val.i > 0 || val.i <= 65535) { + if (key->type == TYPE_STRING) { + int port = strtol(val.str, NULL, 0); + if (port > 0 || port <= 65535) { return 0; } else { - log(LOG_ERR, "Invalid port %d. (Valid port must be between 1, and 65535.)", val.i); + log(LOG_ERR, "Invalid port %d. (Valid port must be between 1, and 65535.)", port); } } else { - log(LOG_ERR, "Keyword \"%s\" doesn't return an integer.", key->key); + log(LOG_ERR, "Keyword \"%s\" doesn't return a string.", key->key); } return -1; } |