summaryrefslogtreecommitdiff
path: root/src/kike.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kike.c')
-rw-r--r--src/kike.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/src/kike.c b/src/kike.c
index 07ec21f..4e49ffe 100644
--- a/src/kike.c
+++ b/src/kike.c
@@ -425,15 +425,6 @@ server_context_free (struct server_context *self)
// --- Main program ------------------------------------------------------------
-static size_t network_error_domain_tag;
-#define NETWORK_ERROR (error_resolve_domain (&network_error_domain_tag))
-
-enum
-{
- NETWORK_ERROR_INVALID_CONFIGURATION,
- NETWORK_ERROR_FAILED
-};
-
static void
client_kill (struct client *c, const char *reason)
{
@@ -1140,8 +1131,7 @@ irc_initialize_catalog (struct server_context *ctx, struct error **e)
char *path = resolve_config_filename (catalog);
if (!path)
{
- error_set (e, IO_ERROR, IO_ERROR_FAILED, "%s: %s",
- "cannot open file", catalog);
+ error_set (e, "%s: %s", "cannot open file", catalog);
return false;
}
ctx->catalog = catopen (path, NL_CAT_LOCALE);
@@ -1149,7 +1139,7 @@ irc_initialize_catalog (struct server_context *ctx, struct error **e)
if (ctx->catalog == (nl_catd) -1)
{
- error_set (e, IO_ERROR, IO_ERROR_FAILED, "%s: %s",
+ error_set (e, "%s: %s",
"failed reading the message catalog file", strerror (errno));
return false;
}
@@ -1167,8 +1157,7 @@ irc_initialize_motd (struct server_context *ctx, struct error **e)
char *path = resolve_config_filename (motd);
if (!path)
{
- error_set (e, IO_ERROR, IO_ERROR_FAILED, "%s: %s",
- "cannot open file", motd);
+ error_set (e, "%s: %s", "cannot open file", motd);
return false;
}
FILE *fp = fopen (path, "r");
@@ -1176,7 +1165,7 @@ irc_initialize_motd (struct server_context *ctx, struct error **e)
if (!fp)
{
- error_set (e, IO_ERROR, IO_ERROR_FAILED, "%s: %s",
+ error_set (e, "%s: %s",
"failed reading the MOTD file", strerror (errno));
return false;
}
@@ -1201,9 +1190,8 @@ irc_initialize_server_name (struct server_context *ctx, struct error **e)
res = irc_validate_hostname (server_name);
if (res != VALIDATION_OK)
{
- error_set (e, NETWORK_ERROR, NETWORK_ERROR_INVALID_CONFIGURATION,
- "invalid configuration value for `%s': %s", "server_name",
- irc_validate_to_str (res));
+ error_set (e, "invalid configuration value for `%s': %s",
+ "server_name", irc_validate_to_str (res));
return false;
}
ctx->server_name = xstrdup (server_name);
@@ -1213,14 +1201,14 @@ irc_initialize_server_name (struct server_context *ctx, struct error **e)
char hostname[HOST_NAME_MAX];
if (gethostname (hostname, sizeof hostname))
{
- error_set (e, NETWORK_ERROR, NETWORK_ERROR_INVALID_CONFIGURATION,
- "%s: %s", "getting the hostname failed", strerror (errno));
+ error_set (e, "%s: %s",
+ "getting the hostname failed", strerror (errno));
return false;
}
res = irc_validate_hostname (hostname);
if (res != VALIDATION_OK)
{
- error_set (e, NETWORK_ERROR, NETWORK_ERROR_INVALID_CONFIGURATION,
+ error_set (e,
"`%s' is not set and the hostname (`%s') cannot be used: %s",
"server_name", hostname, irc_validate_to_str (res));
return false;
@@ -1246,7 +1234,7 @@ irc_listen (struct server_context *ctx, struct error **e)
int err = getaddrinfo (bind_host, bind_port, &gai_hints, &gai_result);
if (err)
{
- error_set (e, NETWORK_ERROR, NETWORK_ERROR_FAILED, "%s: %s: %s",
+ error_set (e, "%s: %s: %s",
"network setup failed", "getaddrinfo", gai_strerror (err));
return false;
}
@@ -1291,8 +1279,7 @@ irc_listen (struct server_context *ctx, struct error **e)
if (!gai_iter)
{
- error_set (e, NETWORK_ERROR, NETWORK_ERROR_FAILED,
- "network setup failed");
+ error_set (e, "network setup failed");
return false;
}