diff options
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/config.c b/src/config.c index 58841c9..26ec810 100644 --- a/src/config.c +++ b/src/config.c @@ -61,6 +61,12 @@ cf_ip_list_parse(union cf_callback_arg *arg, void *data) return rc; } +char *rbt_insert_result_str[] = { + [RBT_LOOKUP_SUCCESS] = "hostname or IP address already exists", + [RBT_LOOKUP_NOENT] = "inserted successfully", + [RBT_LOOKUP_FAILURE] = "out of memory" +}; + int file_read_ip_list(FILE *fp, char const *fname) { @@ -117,8 +123,9 @@ file_read_ip_list(FILE *fp, char const *fname) } rc = pinger_host_add(p, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); - if (rc) { - error("%s:%d: out of memory", fname, ln); + if (rc != RBT_LOOKUP_NOENT) { + error("%s:%d: %s", fname, ln, + rbt_insert_result_str[rc]); ret = CF_RET_FAIL; break; } @@ -173,9 +180,10 @@ cf_ip_list_heredoc(int mode, union cf_callback_arg *arg, void *data) rc = pinger_host_add(arg->heredoc.val, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); - if (rc) { - error("%s:%d: out of memory", arg->heredoc.file, - arg->heredoc.line); + if (rc != RBT_LOOKUP_NOENT) { + error("%s:%d: %s", + arg->heredoc.file, arg->heredoc.line, + rbt_insert_result_str[rc]); return CF_RET_FAIL; } } |