summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/config.c b/config.c
index 012ed3d..30e3e95 100644
--- a/config.c
+++ b/config.c
@@ -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;
}