summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-20 14:55:54 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-20 14:55:54 +0200
commit77f9be38d7469eefb0fac3adf43261b4d84315d2 (patch)
tree70c42ec4864e850e15b0c31b9493646ead42a05b /config.c
parente11014c0443ea687ad65a14b9124aa366da7984a (diff)
Make logging messages consistent in adding a newline for all messages
Diffstat (limited to 'config.c')
-rw-r--r--config.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/config.c b/config.c
index 199ba0b..30c9cde 100644
--- a/config.c
+++ b/config.c
@@ -78,14 +78,14 @@ dnslookup(const char *name, uint16_t port, struct cfg_value *rvalue, bool async)
rvalue->dns_async = NULL;
dns = zmalloc(sizeof(*dns));
if (!dns) {
- error("async DNS lookup of %s failed: %m\n", name);
+ error("async DNS lookup of %s failed: %m", name);
goto out;
}
- debug(DBG_DNS, "doing async DNS lookup of %s: %p\n", name, dns);
+ debug(DBG_DNS, "doing async DNS lookup of %s: %p", name, dns);
} else {
memset(&tmp, 0, sizeof(tmp));
dns = &tmp;
- debug(DBG_DNS, "doing sync DNS lookup of %s\n", name);
+ debug(DBG_DNS, "doing sync DNS lookup of %s", name);
}
sprintf(dns->name, "%s", name);
@@ -108,7 +108,7 @@ dnslookup(const char *name, uint16_t port, struct cfg_value *rvalue, bool async)
r = getaddrinfo_a(mode, gcbs, ARRAY_SIZE(gcbs), &dns->sev);
if (r != 0) {
- error("getaddrinfo(%s:%" PRIu16 "): %s\n", name, port, gai_strerror(r));
+ error("getaddrinfo(%s:%" PRIu16 "): %s", name, port, gai_strerror(r));
goto out;
}
@@ -123,7 +123,7 @@ dnslookup(const char *name, uint16_t port, struct cfg_value *rvalue, bool async)
for (ai = results; ai; ai = ai->ai_next) {
saddr = zmalloc(sizeof(*saddr));
if (!saddr) {
- error("sync DNS lookup of %s failed: %m\n", name);
+ error("sync DNS lookup of %s failed: %m", name);
goto out;
}
@@ -131,19 +131,19 @@ dnslookup(const char *name, uint16_t port, struct cfg_value *rvalue, bool async)
case AF_INET:
in4 = (struct sockaddr_in *)ai->ai_addr;
saddr_set_ipv4(saddr, in4->sin_addr.s_addr, in4->sin_port);
- error("addrstr: %s\n", saddr->addrstr);
+ error("addrstr: %s", saddr->addrstr);
list_add(&saddr->list, &rvalue->saddrs);
break;
case AF_INET6:
in6 = (struct sockaddr_in6 *)ai->ai_addr;
saddr_set_ipv6(saddr, &in6->sin6_addr, in6->sin6_port);
- error("addrstr: %s\n", saddr->addrstr);
+ error("addrstr: %s", saddr->addrstr);
list_add(&saddr->list, &rvalue->saddrs);
break;
default:
- error("getaddrinfo(%s:%s): unknown address family (%i)\n",
+ error("getaddrinfo(%s:%s): unknown address family (%i)",
dns->name, dns->port, ai->ai_family);
xfree(saddr);
break;
@@ -175,7 +175,7 @@ strtosockaddrs(const char *str, struct cfg_value *rvalue, bool async)
if (*str == '[') {
/* IPv6, [a:b:c...h]:p or [*]:p */
- debug(DBG_CFG, "attempting to parse IPv6 addr (%s)\n", str);
+ debug(DBG_CFG, "attempting to parse IPv6 addr (%s)", str);
str++;
tmp = strchr(str, ']');
@@ -208,7 +208,7 @@ strtosockaddrs(const char *str, struct cfg_value *rvalue, bool async)
} else if (*str == '*') {
/* IPv4, *:p */
- debug(DBG_CFG, "attempting to parse IPv4 addr (%s)\n", str);
+ debug(DBG_CFG, "attempting to parse IPv4 addr (%s)", str);
str++;
if (*str != ':')
@@ -228,7 +228,7 @@ strtosockaddrs(const char *str, struct cfg_value *rvalue, bool async)
} else if ((tmp = strchr(str, ':'))) {
/* IPv4, a.b.c.d:p or IPv4/6 hostname:p */
- debug(DBG_CFG, "attempting to parse IPv4 addr or hostname (%s)\n", str);
+ debug(DBG_CFG, "attempting to parse IPv4 addr or hostname (%s)", str);
*tmp = '\0';
tmp++;
@@ -240,7 +240,7 @@ strtosockaddrs(const char *str, struct cfg_value *rvalue, bool async)
goto error;
if (inet_pton(AF_INET, str, &saddr->in4.sin_addr) > 0) {
- debug(DBG_CFG, "got an IPv4:port (%s:%" PRIu16 ")\n", str, port);
+ debug(DBG_CFG, "got an IPv4:port (%s:%" PRIu16 ")", str, port);
saddr_set_ipv4(saddr, saddr->in4.sin_addr.s_addr, htons(port));
list_add(&saddr->list, list);
naddrs++;
@@ -248,13 +248,13 @@ strtosockaddrs(const char *str, struct cfg_value *rvalue, bool async)
}
xfree(saddr);
- debug(DBG_CFG, "maybe got a hostname:port (%s:%" PRIu16 ")\n", str, port);
+ debug(DBG_CFG, "maybe got a hostname:port (%s:%" PRIu16 ")", str, port);
if (!dnslookup(str, port, rvalue, async))
goto error;
} else if (strtou16_strict(tmp, &port) == 0) {
/* Port */
- debug(DBG_CFG, "attempting to parse a port number (%s)\n", str);
+ debug(DBG_CFG, "attempting to parse a port number (%s)", str);
saddr = zmalloc(sizeof(*saddr));
if (!saddr)
@@ -274,7 +274,7 @@ strtosockaddrs(const char *str, struct cfg_value *rvalue, bool async)
} else {
/* Unknown */
- error("unable to parse address: %s\n", str);
+ error("unable to parse address: %s", str);
goto error;
}
@@ -282,19 +282,19 @@ success:
switch (rvalue->type) {
case CFG_VAL_TYPE_ADDRS:
if (list_empty(list) || naddrs == 0) {
- error("empty address list!?\n");
+ error("empty address list");
return false;
}
- debug(DBG_CFG, "parsed to %u addresses\n", naddrs);
+ debug(DBG_CFG, "parsed to %u addresses", naddrs);
return true;
case CFG_VAL_TYPE_ASYNC_ADDRS:
- debug(DBG_CFG, "looking up address asynchronously\n");
+ debug(DBG_CFG, "looking up address asynchronously");
return true;
default:
- error("invalid rvalue type\n");
+ error("invalid rvalue type");
rvalue->type = CFG_VAL_TYPE_INVALID;
break;
}
@@ -328,7 +328,7 @@ config_parse_line(struct cfg *cfg, const char *filename, char **buf,
if (!line)
return false;
- debug(DBG_CFG, "%s: parsing config line: %s\n", filename, line);
+ debug(DBG_CFG, "%s: parsing config line: %s", filename, line);
tmp = line;
while (isspace(*tmp))
@@ -387,12 +387,12 @@ config_parse_line(struct cfg *cfg, const char *filename, char **buf,
goto error;
if (rvalue->type != CFG_VAL_TYPE_ADDRS) {
- error("invalid type returned from strtosockaddrs\n");
+ error("invalid type returned from strtosockaddrs");
goto error;
}
if (list_empty(&rvalue->saddrs)) {
- error("empty address list\n");
+ error("empty address list");
goto error;
}
break;
@@ -404,20 +404,20 @@ config_parse_line(struct cfg *cfg, const char *filename, char **buf,
switch (rvalue->type) {
case CFG_VAL_TYPE_ADDRS:
if (list_empty(&rvalue->saddrs)) {
- error("empty address list\n");
+ error("empty address list");
goto error;
}
break;
case CFG_VAL_TYPE_ASYNC_ADDRS:
if (!rvalue->dns_async) {
- error("dns_async not set\n");
+ error("dns_async not set");
goto error;
}
break;
default:
- error("invalid type returned from strtosockaddrs\n");
+ error("invalid type returned from strtosockaddrs");
goto error;
}
@@ -431,7 +431,7 @@ config_parse_line(struct cfg *cfg, const char *filename, char **buf,
rvalue->type = CFG_VAL_TYPE_BOOL;
rvalue->boolean = false;
} else {
- error("invalid boolean value (%s)\n", tmp);
+ error("invalid boolean value (%s)", tmp);
goto error;
}
break;
@@ -446,7 +446,7 @@ config_parse_line(struct cfg *cfg, const char *filename, char **buf,
if ((rvalue->type != kvmap[i].value_type) &&
((kvmap[i].value_type != CFG_VAL_TYPE_ASYNC_ADDRS) &&
(rvalue->type != CFG_VAL_TYPE_ADDRS))) {
- error("rvalue->type != kvmap->type\n");
+ error("rvalue->type != kvmap->type");
goto error;
}
@@ -457,7 +457,7 @@ config_parse_line(struct cfg *cfg, const char *filename, char **buf,
error:
/* FIXME: the line is already mangled here, a line number would be nice */
- error("%s: invalid config line: %s\n", filename, line);
+ error("%s: invalid config line: %s", filename, line);
rvalue->type = CFG_VAL_TYPE_INVALID;
*rkey = 0;
*rkeyname = NULL;
@@ -477,14 +477,14 @@ config_parse_header(struct cfg *cfg, const char *filename, const char *title,
line = get_line(buf);
if (!line) {
- error("%s: missing header in configuration file\n", filename);
+ error("%s: missing header in configuration file", filename);
return false;
} else {
char titlehdr[strlen(title) + 3];
sprintf(titlehdr, "[%s]", title);
if (strcmp(line, titlehdr)) {
- error("%s: incorrect header in configuration file\n", filename);
+ error("%s: incorrect header in configuration file", filename);
return false;
}
}