diff options
-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; } |