Commit 46aff9b7 authored by Jan Včelák's avatar Jan Včelák 🚀

logging: remove terminating newline from all log messages

parent ec8a0e88
......@@ -481,7 +481,7 @@ int log_reconfigure(const struct conf_t *conf, void *data)
if (facility == LOGT_FILE) {
facility = log_open_file(log, facility_conf->file);
if (facility < 0) {
log_error("Failed to open logfile '%s'\n",
log_error("Failed to open logfile '%s'",
facility_conf->file);
continue;
}
......
......@@ -84,7 +84,7 @@ static void cf_print_error(void *scanner, const char *msg)
filename = new_config->filename;
}
log_error("config error in '%s' (line %d token '%s'): %s\n",
log_error("config error in '%s' (line %d token '%s'): %s",
filename, lineno, text, msg);
_parser_res = KNOT_EPARSEFAIL;
......@@ -226,7 +226,7 @@ static int conf_process(conf_t *conf)
/* Check for ACL existence. */
if (!EMPTY_LIST(conf->ctl.allow)) {
log_warning("control 'allow' statement does not "
"affect UNIX sockets\n");
"affect UNIX sockets");
}
} else if (sockaddr_port(&ctl_if->addr) <= 0) {
sockaddr_port_set(&ctl_if->addr, REMOTE_DPORT);
......@@ -365,7 +365,7 @@ static int conf_process(conf_t *conf)
) {
log_zone_str_notice(zone->name, "automatic "
"DNSSEC signing enabled, disabling "
"incoming XFRs\n");
"incoming XFRs");
WALK_LIST_FREE(zone->acl.notify_in);
WALK_LIST_FREE(zone->acl.xfr_in);
......@@ -393,13 +393,13 @@ static int conf_process(conf_t *conf)
/* Check paths existence. */
if (!is_existing_dir(zone->storage)) {
log_error("storage directory '%s' does not exist\n",
log_error("storage directory '%s' does not exist",
zone->storage);
ret = KNOT_EINVAL;
continue;
}
if (zone->dnssec_enable && !is_existing_dir(zone->dnssec_keydir)) {
log_error("DNSSEC key directory '%s' does not exist\n",
log_error("DNSSEC key directory '%s' does not exist",
zone->dnssec_keydir);
ret = KNOT_EINVAL;
continue;
......@@ -820,8 +820,9 @@ char* strcpath(char *path)
char* remainder = strchr(path,'~');
if (remainder != NULL) {
if (remainder[1] != '/') {
log_warning("cannot expand non-login user home"
"directory '%s', use full path instead", path);
log_warning("cannot expand non-login user home "
"directory '%s', use full path instead",
path);
}
// Get full path
......
......@@ -183,14 +183,14 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[])
/* Check remote address. */
conf_iface_t *r = conf()->ctl.iface;
if (!r || r->addr.ss_family == AF_UNSPEC) {
log_error("no remote address for '%s' configured\n", cmd);
log_error("no remote address for '%s' configured", cmd);
return 1;
}
/* Make query. */
knot_pkt_t *pkt = remote_query(cmd, r->key);
if (!pkt) {
log_warning("could not prepare query for '%s'\n", cmd);
log_warning("could not prepare query for '%s'", cmd);
return 1;
}
......@@ -200,7 +200,7 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[])
knot_rrset_t rr;
int res = remote_build_rr(&rr, "data.", rrt);
if (res != KNOT_EOK) {
log_error("couldn't create the query\n");
log_error("couldn't create the query");
knot_pkt_free(&pkt);
return 1;
}
......@@ -217,7 +217,7 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[])
}
res = knot_pkt_put(pkt, 0, &rr, KNOT_PF_FREE);
if (res != KNOT_EOK) {
log_error("couldn't create the query\n");
log_error("couldn't create the query");
knot_rrset_clear(&rr, NULL);
knot_pkt_free(&pkt);
return 1;
......@@ -227,7 +227,7 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[])
if (r->key) {
int res = remote_query_sign(pkt->wire, &pkt->size, pkt->max_size, r->key);
if (res != KNOT_EOK) {
log_error("couldn't sign the packet\n");
log_error("couldn't sign the packet");
knot_pkt_free(&pkt);
return 1;
}
......@@ -241,7 +241,7 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[])
int s = net_connected_socket(SOCK_STREAM, &r->addr, &r->via, 0);
if (s < 0) {
log_error("couldn't connect to remote host '%s'\n", addr_str);
log_error("couldn't connect to remote host '%s'", addr_str);
knot_pkt_free(&pkt);
return 1;
}
......@@ -249,7 +249,7 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[])
/* Wait for availability. */
struct pollfd pfd = { s, POLLOUT, 0 };
if (poll(&pfd, 1, conf()->max_conn_reply) != 1) {
log_error("couldn't connect to remote host '%s'\n", addr_str);
log_error("couldn't connect to remote host '%s'", addr_str);
close(s);
knot_pkt_free(&pkt);
return 1;
......@@ -261,7 +261,7 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[])
/* Evaluate and wait for reply. */
if (ret <= 0) {
log_error("couldn't connect to remote host '%s'\n", addr_str);
log_error("couldn't connect to remote host '%s'", addr_str);
close(s);
return 1;
}
......@@ -272,7 +272,7 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[])
ret = cmd_remote_reply(s);
if (ret != KNOT_EOK) {
if (ret != KNOT_ECONN) {
log_warning("remote command reply: %s\n",
log_warning("remote command reply: %s",
knot_strerror(ret));
rc = 1;
}
......@@ -373,7 +373,7 @@ static int tsig_parse_file(knot_tsig_key_t *k, const char *f)
{
FILE* fp = fopen(f, "r");
if (!fp) {
log_error("couldn't open key-file '%s'\n", f);
log_error("couldn't open key-file '%s'", f);
return KNOT_EINVAL;
}
......@@ -394,7 +394,7 @@ static int tsig_parse_file(knot_tsig_key_t *k, const char *f)
if (c == '\n') {
if (k->name) {
log_error("only one key definition allowed "
"in '%s'\n", f);
"in '%s'", f);
ret = KNOT_EMALF;
break;
}
......@@ -455,14 +455,14 @@ int main(int argc, char **argv)
case 'y':
if (tsig_parse_str(&r_key, optarg) != KNOT_EOK) {
rc = 1;
log_error("couldn't parse TSIG key '%s'\n", optarg);
log_error("couldn't parse TSIG key '%s'", optarg);
goto exit;
}
break;
case 'k':
if (tsig_parse_file(&r_key, optarg) != KNOT_EOK) {
rc = 1;
log_error("couldn't parse TSIG key file '%s'\n", optarg);
log_error("couldn't parse TSIG key file '%s'", optarg);
goto exit;
}
break;
......@@ -512,7 +512,7 @@ int main(int argc, char **argv)
/* Command not found. */
if (!cmd->name) {
log_error("invalid command: '%s'\n", argv[optind]);
log_error("invalid command: '%s'", argv[optind]);
rc = 1;
goto exit;
}
......@@ -525,7 +525,7 @@ int main(int argc, char **argv)
/* Check if config file is required. */
if (has_flag(flags, F_NOCONF) && cmd->need_conf) {
log_error("couldn't find a config file, refusing to continue\n");
log_error("couldn't find a config file, refusing to continue");
rc = 1;
goto exit;
}
......@@ -654,7 +654,7 @@ static int cmd_checkconf(int argc, char *argv[], unsigned flags)
UNUSED(argv);
UNUSED(flags);
log_info("OK, configuration is valid\n");
log_info("OK, configuration is valid");
return 0;
}
......@@ -702,7 +702,7 @@ static int cmd_checkzone(int argc, char *argv[], unsigned flags)
continue;
}
log_zone_str_info(zone->name, "zone is OK\n");
log_zone_str_info(zone->name, "zone is OK");
zone_contents_deep_free(&loaded_zone);
}
hattrie_iter_free(z_iter);
......@@ -759,7 +759,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
.htable_size = 0, .rdata_size = 0,
.record_count = 0 };
if (est.node_table == NULL) {
log_error("not enough memory\n");
log_error("not enough memory");
continue;
}
......@@ -771,7 +771,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
&est);
if (loader == NULL) {
rc = 1;
log_zone_str_error(zone->name, "could not load zone\n");
log_zone_str_error(zone->name, "could not load zone");
hattrie_free(est.node_table);
continue;
}
......@@ -780,7 +780,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
int ret = zs_loader_process(loader);
if (ret != KNOT_EOK) {
rc = 1;
log_zone_str_error(zone->name, "failed to parse zone\n");
log_zone_str_error(zone->name, "failed to parse zone");
hattrie_apply_rev(est.node_table, estimator_free_trie_node, NULL);
hattrie_free(est.node_table);
zs_loader_free(loader);
......@@ -801,7 +801,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
est.htable_size +
malloc_size) * ESTIMATE_MAGIC) / (1024.0 * 1024.0);
log_zone_str_info(zone->name, "%zu RRs, used memory estimation is %zu MB\n",
log_zone_str_info(zone->name, "%zu RRs, used memory estimation is %zu MB",
est.record_count, (size_t)zone_size);
zs_loader_free(loader);
total_size += zone_size;
......@@ -810,7 +810,7 @@ static int cmd_memstats(int argc, char *argv[], unsigned flags)
hattrie_iter_free(z_iter);
if (rc == 0 && argc == 0) { // for all zones
log_info("estimated memory consumption for all zones is %zu MB\n",
log_info("estimated memory consumption for all zones is %zu MB",
(size_t)total_size);
}
......
......@@ -140,17 +140,17 @@ int proc_update_privileges(int uid, int gid)
if ((uid_t)uid != getuid() || (gid_t)gid != getgid()) {
if (setgroups(0, NULL) < 0) {
log_warning("failed to drop supplementary groups for "
"UID '%d': %s\n", getuid(), strerror(errno));
"UID '%d': %s", getuid(), strerror(errno));
}
# ifdef HAVE_INITGROUPS
struct passwd *pw;
if ((pw = getpwuid(uid)) == NULL) {
log_warning("failed to get passwd entry for UID '%d': %s\n",
log_warning("failed to get passwd entry for UID '%d': %s",
uid, strerror(errno));
} else {
if (initgroups(pw->pw_name, gid) < 0) {
log_warning("failed to set supplementary groups "
"for UID '%d': %s\n", uid, strerror(errno));
"for UID '%d': %s", uid, strerror(errno));
}
}
# endif /* HAVE_INITGROUPS */
......@@ -159,15 +159,15 @@ int proc_update_privileges(int uid, int gid)
/* Watch uid/gid. */
if ((gid_t)gid != getgid()) {
log_info("changing GID to '%d'\n", gid);
log_info("changing GID to '%d'", gid);
if (setregid(gid, gid) < 0) {
log_error("failed to change GID to '%d'\n", gid);
log_error("failed to change GID to '%d'", gid);
}
}
if ((uid_t)uid != getuid()) {
log_info("changing UID to '%d'\n", uid);
log_info("changing UID to '%d'", uid);
if (setreuid(uid, uid) < 0) {
log_error("failed to change UID to '%d'\n", uid);
log_error("failed to change UID to '%d'", uid);
}
}
......@@ -184,7 +184,7 @@ int proc_update_privileges(int uid, int gid)
assert(lfile != NULL);
FILE* fp = fopen(lfile, "w");
if (fp == NULL) {
log_warning("storage directory '%s' is not writable\n",
log_warning("storage directory '%s' is not writable",
zone->storage);
ret = KNOT_EACCES;
} else {
......@@ -210,18 +210,18 @@ char *pid_check_and_create()
/* Check PID for existence and liveness. */
if (pid > 0 && pid_running(pid)) {
log_error("server PID found, already running\n");
log_error("server PID found, already running");
free(pidfile);
return NULL;
} else if (stat(pidfile, &st) == 0) {
log_warning("removing stale PID file '%s'\n", pidfile);
log_warning("removing stale PID file '%s'", pidfile);
pid_remove(pidfile);
}
/* Create a PID file. */
int ret = pid_write(pidfile);
if (ret != KNOT_EOK) {
log_error("couldn't create a PID file '%s'\n", pidfile);
log_error("couldn't create a PID file '%s'", pidfile);
free(pidfile);
return NULL;
}
......
......@@ -411,7 +411,7 @@ int remote_bind(conf_iface_t *desc)
char addr_str[SOCKADDR_STRLEN] = {0};
sockaddr_tostr(&desc->addr, addr_str, sizeof(addr_str));
log_info("binding remote control interface to '%s'\n", addr_str);
log_info("binding remote control interface to '%s'", addr_str);
/* Create new socket. */
mode_t old_umask = umask(KNOT_CTL_SOCKET_UMASK);
......@@ -424,7 +424,7 @@ int remote_bind(conf_iface_t *desc)
/* Start listening. */
int ret = listen(sock, TCP_BACKLOG_SIZE);
if (ret < 0) {
log_error("could not bind to '%s'\n", addr_str);
log_error("could not bind to '%s'", addr_str);
close(sock);
return ret;
}
......@@ -563,7 +563,7 @@ static void log_command(const char *cmd, const remote_cmdargs_t* args)
}
}
log_info("remote command: '%s%s'\n", cmd, params);
log_info("remote command: '%s%s'", cmd, params);
}
int remote_answer(int sock, server_t *s, knot_pkt_t *pkt)
......@@ -657,7 +657,7 @@ static int zones_verify_tsig_query(const knot_pkt_t *query,
assert(tsig_rcode != NULL);
if (query->tsig_rr == NULL) {
log_info("TSIG: key required, query REFUSED\n");
log_info("TSIG: key required, query REFUSED");
*rcode = KNOT_RCODE_REFUSED;
return KNOT_TSIG_EBADKEY;
}
......@@ -667,7 +667,7 @@ static int zones_verify_tsig_query(const knot_pkt_t *query,
*/
knot_tsig_algorithm_t alg = tsig_rdata_alg(query->tsig_rr);
if (knot_tsig_digest_length(alg) == 0) {
log_info("TSIG: unsupported algorithm, query NOTAUTH\n");
log_info("TSIG: unsupported algorithm, query NOTAUTH");
/*! \todo [TSIG] It is unclear from RFC if I
* should treat is as a bad key
* or some other error.
......@@ -710,7 +710,7 @@ static int zones_verify_tsig_query(const knot_pkt_t *query,
if (mac_len > digest_max_size) {
*rcode = KNOT_RCODE_FORMERR;
log_info("TSIG: MAC length %zu exceeds maximum size %zu\n",
log_info("TSIG: MAC length %zu exceeds maximum size %zu",
mac_len, digest_max_size);
return KNOT_EMALF;
} else {
......@@ -790,7 +790,7 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock,
uint64_t ts_tmsigned = 0;
if (match == NULL) {
log_warning("denied remote control for '%s', "
"no matching ACL\n", addr_str);
"no matching ACL", addr_str);
remote_senderr(client, pkt->wire, pkt->size);
ret = KNOT_EACCES;
goto finish;
......@@ -802,7 +802,7 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock,
if (tsig_key) {
if (pkt->tsig_rr == NULL) {
log_warning("denied remote control for '%s', "
"key required\n", addr_str);
"key required", addr_str);
remote_senderr(client, pkt->wire, pkt->size);
ret = KNOT_EACCES;
goto finish;
......@@ -811,7 +811,7 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock,
&ts_trc, &ts_tmsigned);
if (ret != KNOT_EOK) {
log_warning("denied remote control for '%s', "
"key verification failed\n", addr_str);
"key verification failed", addr_str);
remote_senderr(client, pkt->wire, pkt->size);
ret = KNOT_EACCES;
goto finish;
......
......@@ -44,7 +44,7 @@ static int init_dnssec_structs(const zone_contents_t *zone,
zone->apex->owner,
nsec3_enabled, zone_keys);
if (result != KNOT_EOK) {
log_zone_error(zone->apex->owner, "DNSSEC: failed to load keys: %s\n",
log_zone_error(zone->apex->owner, "DNSSEC: failed to load keys: %s",
knot_strerror(result));
knot_free_zone_keys(zone_keys);
return result;
......@@ -72,7 +72,7 @@ static int zone_sign(zone_contents_t *zone, const conf_zone_t *zone_config,
const knot_dname_t *zone_name = zone->apex->owner;
log_zone_info(zone_name, "DNSSEC: signing started\n");
log_zone_info(zone_name, "DNSSEC: signing started");
uint32_t new_serial = zone_contents_next_serial(zone, zone_config->serial_policy);
dbg_dnssec_verb("changeset empty before generating NSEC chain: %d\n",
......@@ -92,7 +92,7 @@ static int zone_sign(zone_contents_t *zone, const conf_zone_t *zone_config,
result = knot_zone_create_nsec_chain(zone, out_ch,
&zone_keys, &policy);
if (result != KNOT_EOK) {
log_zone_error(zone_name, "DNSSEC: could not create NSEC(3) chain: %s\n",
log_zone_error(zone_name, "DNSSEC: could not create NSEC(3) chain: %s",
knot_strerror(result));
knot_free_zone_keys(&zone_keys);
return result;
......@@ -104,7 +104,7 @@ static int zone_sign(zone_contents_t *zone, const conf_zone_t *zone_config,
result = knot_zone_sign(zone, &zone_keys, &policy, out_ch,
refresh_at);
if (result != KNOT_EOK) {
log_zone_error(zone_name, "DNSSEC: error while signing: %s\n",
log_zone_error(zone_name, "DNSSEC: error while signing: %s",
knot_strerror(result));
knot_free_zone_keys(&zone_keys);
return result;
......@@ -115,7 +115,7 @@ static int zone_sign(zone_contents_t *zone, const conf_zone_t *zone_config,
// Check if only SOA changed
if (changeset_empty(out_ch) &&
!knot_zone_sign_soa_expired(zone, &zone_keys, &policy)) {
log_zone_info(zone_name, "DNSSEC: no signing performed, zone is valid\n");
log_zone_info(zone_name, "DNSSEC: no signing performed, zone is valid");
knot_free_zone_keys(&zone_keys);
assert(changeset_empty(out_ch));
return KNOT_EOK;
......@@ -129,7 +129,7 @@ static int zone_sign(zone_contents_t *zone, const conf_zone_t *zone_config,
new_serial, out_ch);
if (result != KNOT_EOK) {
log_zone_error(zone_name, "DNSSEC: not signing, cannot update "
"SOA record: %s\n", knot_strerror(result));
"SOA record: %s", knot_strerror(result));
knot_free_zone_keys(&zone_keys);
return result;
}
......@@ -138,7 +138,7 @@ static int zone_sign(zone_contents_t *zone, const conf_zone_t *zone_config,
dbg_dnssec_detail("zone signed: changes=%zu\n",
changeset_size(out_ch));
log_zone_info(zone_name, "DNSSEC: successfully signed\n");
log_zone_info(zone_name, "DNSSEC: successfully signed");
return KNOT_EOK;
}
......@@ -195,7 +195,7 @@ int knot_dnssec_sign_changeset(const zone_contents_t *zone,
ret = knot_zone_sign_changeset(zone, in_ch, out_ch,
&zone_keys, &policy);
if (ret != KNOT_EOK) {
log_zone_error(zone_name, "DNSSEC: failed to sign changeset: %s\n",
log_zone_error(zone_name, "DNSSEC: failed to sign changeset: %s",
knot_strerror(ret));
knot_free_zone_keys(&zone_keys);
return ret;
......@@ -204,7 +204,7 @@ int knot_dnssec_sign_changeset(const zone_contents_t *zone,
// Create NSEC(3) chain
ret = knot_zone_create_nsec_chain(zone, out_ch, &zone_keys, &policy);
if (ret != KNOT_EOK) {
log_zone_error(zone_name, "DNSSEC: failed to create NSEC(3) chain: %s\n",
log_zone_error(zone_name, "DNSSEC: failed to create NSEC(3) chain: %s",
knot_strerror(ret));
knot_free_zone_keys(&zone_keys);
return ret;
......@@ -214,7 +214,7 @@ int knot_dnssec_sign_changeset(const zone_contents_t *zone,
ret = knot_zone_sign_nsecs_in_changeset(&zone_keys, &policy,
out_ch);
if (ret != KNOT_EOK) {
log_zone_error(zone_name, "DNSSEC: failed to sign changeset: %s\n",
log_zone_error(zone_name, "DNSSEC: failed to sign changeset: %s",
knot_strerror(ret));
knot_free_zone_keys(&zone_keys);
return ret;
......@@ -226,7 +226,7 @@ int knot_dnssec_sign_changeset(const zone_contents_t *zone,
ret = knot_zone_sign_update_soa(&soa, &rrsigs, &zone_keys, &policy,
new_serial, out_ch);
if (ret != KNOT_EOK) {
log_zone_error(zone_name, "DNSSEC: failed to sign SOA RR: %s\n",
log_zone_error(zone_name, "DNSSEC: failed to sign SOA RR: %s",
knot_strerror(ret));
knot_free_zone_keys(&zone_keys);
return ret;
......
......@@ -158,7 +158,7 @@ int knot_load_zone_keys(const char *keydir_name, const knot_dname_t *zone_name,
free(path);
if (ret != KNOT_EOK) {
log_zone_warning(zone_name, "DNSSEC: failed to load key '%s': %s\n",
log_zone_warning(zone_name, "DNSSEC: failed to load key '%s': %s",
entry->d_name, knot_strerror(ret));
knot_free_key_params(&params);
continue;
......@@ -190,7 +190,7 @@ int knot_load_zone_keys(const char *keydir_name, const knot_dname_t *zone_name,
nsec3_enabled)
) {
log_zone_notice(zone_name, "DNSSEC: ignoring key %d (%s): "
"incompatible algorithm\n",
"incompatible algorithm",
params.keytag, entry->d_name);
knot_free_key_params(&params);
free(key);
......@@ -199,7 +199,7 @@ int knot_load_zone_keys(const char *keydir_name, const knot_dname_t *zone_name,
if (knot_get_zone_key(keys, params.keytag) != NULL) {
log_zone_notice(zone_name, "DNSSEC: ignoring key %d (%s): "
"duplicate keytag\n",
"duplicate keytag",
params.keytag, entry->d_name);
knot_free_key_params(&params);
free(key);
......@@ -209,7 +209,7 @@ int knot_load_zone_keys(const char *keydir_name, const knot_dname_t *zone_name,
ret = knot_dnssec_key_from_params(&params, &key->dnssec_key);
if (ret != KNOT_EOK) {
log_zone_error(zone_name, "DNSSEC: failed to process "
"key %d (%s): %s\n",
"key %d (%s): %s",
params.keytag, entry->d_name,
knot_strerror(ret));
knot_free_key_params(&params);
......@@ -217,7 +217,7 @@ int knot_load_zone_keys(const char *keydir_name, const knot_dname_t *zone_name,
continue;
}
log_zone_info(zone_name, "DNSSEC: loaded key %5d, file %s, %s, %s, %s\n",
log_zone_info(zone_name, "DNSSEC: loaded key %5d, file %s, %s, %s, %s",
params.keytag, entry->d_name,
key->is_ksk ? "KSK" : "ZSK",
key->is_active ? "active" : "inactive",
......
......@@ -62,7 +62,7 @@ static void knot_crypto_deinit(void)
static void pid_cleanup(char *pidfile)
{
if (pidfile && pid_remove(pidfile) < 0) {
log_warning("failed to remove PID file\n");
log_warning("failed to remove PID file");
}
}
......@@ -114,12 +114,12 @@ static void setup_capabilities(void)
/* Apply. */
if (capng_apply(CAPNG_SELECT_BOTH) < 0) {
log_error("couldn't set process capabilities: %s\n",
log_error("couldn't set process capabilities: %s",
strerror(errno));
}
} else {
log_info("user UID %d is not allowed to set capabilities, "
"skipping\n", getuid());
"skipping", getuid());
}
#endif /* HAVE_CAP_NG_H */
}
......@@ -267,7 +267,7 @@ int main(int argc, char **argv)
int res = conf_open(config_fn);
conf_t *config = conf();
if (res != KNOT_EOK) {
log_fatal("couldn't load configuration '%s': %s\n",
log_fatal("couldn't load configuration '%s': %s",
config_fn, knot_strerror(res));
return EXIT_FAILURE;
}
......@@ -281,7 +281,7 @@ int main(int argc, char **argv)
server_t server;
res = server_init(&server, conf_bg_threads(config));
if (res != KNOT_EOK) {
log_fatal("could not initialize server: %s\n", knot_strerror(res));
log_fatal("could not initialize server: %s", knot_strerror(res));
conf_free(conf());
log_close();
return EXIT_FAILURE;
......@@ -291,7 +291,7 @@ int main(int argc, char **argv)
* @note This MUST be done before we drop privileges. */
server_reconfigure(config, &server);
conf_add_hook(config, CONF_ALL, server_reconfigure, &server);
log_info("configured %zu interfaces and %zu zones\n",
log_info("configured %zu interfaces and %zu zones",
list_size(&config->ifaces), hattrie_weight(config->zones));
......@@ -316,12 +316,12 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
log_info("PID stored in '%s'\n", pidfile);
log_info("PID stored in '%s'", pidfile);
if (chdir(daemon_root) != 0) {
log_warning("can't change working directory to %s\n",
log_warning("can't change working directory to %s",
daemon_root);
} else {
log_info("changed directory to %s\n", daemon_root);
log_info("changed directory to %s", daemon_root);
}
}
......@@ -336,20 +336,20 @@ int main(int argc, char **argv)
rcu_register_thread();
/* Populate zone database and add reconfiguration hook. */
log_info("loading zones\n");
log_info("loading zones");
server_update_zones(config, &server);
conf_add_hook(config, CONF_ALL, server_update_zones, &server);
/* Check number of loaded zones. */
if (knot_zonedb_size(server.zone_db) == 0) {
log_warning("no zones loaded\n");
log_warning("no zones loaded");
}
/* Start it up. */
log_info("starting server\n");
log_info("starting server");
res = server_start(&server, config->async_start);
if (res != KNOT_EOK) {
log_fatal("failed to start server: %s\n", knot_strerror(res));
log_fatal("failed to start server: %s", knot_strerror(res));
server_deinit(&server);
rcu_unregister_thread();
pid_cleanup(pidfile);
......@@ -359,9 +359,9 @@ int main(int argc, char **argv)
}
if (daemonize) {
log_info("server started as a daemon, PID %ld\n", pid);
log_info("server started as a daemon, PID %ld", pid);
} else {
log_info("server started in foreground, PID %ld\n", pid);
log_info("server started in foreground, PID %ld", pid);
init_signal_started();
}
......@@ -381,7 +381,7 @@ int main(int argc, char **argv)
/* Cleanup PID file. */
pid_cleanup(pidfile);
log_info("shutting down\n");
log_info("shutting down");
log_close();
return EXIT_SUCCESS;
......
......@@ -204,7 +204,7 @@ int dnstap_load(struct query_plan *plan, struct query_module *self)
return KNOT_EOK;
fail:
MODULE_ERR("init(\"%s\") failed - %s\n", self->param, knot_strerror(ret));
MODULE_ERR("init(\"%s\") failed - %s", self->param, knot_strerror(ret));
return ret;
}
......
......@@ -347,14 +347,14 @@ int synth_record_load(struct query_plan *plan, struct query_module *self)
} else if (strcmp(token, "forward") == 0) {
tpl->type = SYNTH_FORWARD;
} else {
MODULE_ERR("invalid type '%s'\n", token);
MODULE_ERR("invalid type '%s'", token);
return KNOT_ENOTSUP;
}
/* Parse format string. */
tpl->prefix = strtok_r(NULL, " ", &saveptr);
if (strchr(tpl->prefix, '.') != NULL) {
MODULE_ERR("dots '.' are not allowed in the prefix\n");
MODULE_ERR("dots '.' are not allowed in the prefix");
return KNOT_EMALF;
}
......@@ -363,7 +363,7 @@ int synth_record_load(struct query_plan *plan, struct query_module *self)
tpl->zone = strtok_r(NULL, " ", &saveptr);
knot_dname_t *check_name = knot_dname_from_str(tpl->zone);
if (check_name == NULL) {
MODULE_ERR("invalid zone '%s'\n", tpl->zone);
MODULE_ERR("invalid zone '%s'", tpl->zone);
return KNOT_EMALF;
}
knot_dname_free(&check_name, NULL);
......@@ -390,13 +390,13 @@ int synth_record_load(struct query_plan *plan, struct query_module *self)
/* Check subnet. */
if (tpl->subnet.prefix > prefix_max) {
MODULE_ERR("invalid address prefix '%s'\n", subnet);
MODULE_ERR("invalid address prefix '%s'", subnet);
return KNOT_EMALF;
}
int ret = sockaddr_set(&tpl->subnet.addr, family, token, 0);
if (ret != KNOT_EOK) {
MODULE_ERR("invalid address '%s'\n", token);
MODULE_ERR("invalid address '%s'", token);
return KNOT_EMALF;
}
......
......@@ -39,7 +39,7 @@ const knot_process_module_t *process_query_get_module(void);
#define NS_PROC_LOG(severity, remote, zone_name, operation, msg, ...) do { \
char addr_str[SOCKADDR_STRLEN] = {0}; \
sockaddr_tostr(remote, addr_str, sizeof(addr_str)); \
log_msg_zone(severity, zone_name, operation ", %s: " msg "\n", \
log_msg_zone(severity, zone_name, operation ", %s: " msg, \
addr_str, ##__VA_ARGS__); \
} while (0)
......
......@@ -57,7 +57,7 @@ int net_unbound_socket(int type, const struct sockaddr_storage *ss)
/* Create socket. */
int socket = socket_create(ss->ss_family, type, 0);
if (socket < 0) {
log_error("could not create socket for '%s': %s\n",
log_error("could not create socket for '%s': %s",
addr_str, knot_strerror(socket));
return socket;
}
......@@ -96,7 +96,7 @@ int net_bound_socket(int type, const struct sockaddr_storage *ss)
int ret = bind(socket, (const struct sockaddr *)ss, sockaddr_len(ss));
if (ret < 0) {
ret = knot_map_errno(EADDRINUSE, EINVAL, EACCES, ENOMEM);
log_error("cannot bind to address '%s': %s\n",
log_error("cannot bind to address '%s': %s",
addr_str, knot_strerror(ret));
close(socket);
return ret;
......
......@@ -286,7 +286,7 @@ static void rrl_log_state(const struct sockaddr_storage *ss, uint16_t flags, uin
what = "enters";
}
log_notice("address '%s' %s rate-limiting (class '%s')\n",
log_notice("address '%s' %s rate-limiting (class '%s')",
addr_str, what, rrl_clsstr(cls));
#endif
}
......
......@@ -142,7 +142,7 @@ static int server_init_iface(iface_t *new_if, conf_iface_t *cfg_if)
if (ret < 0) {
close(new_if->fd[IO_UDP]);
close(new_if->fd[IO_TCP]);