Skip to content
Snippets Groups Projects
Commit 4a9e8532 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Do not print empty portnumber for AF_UNIX remote control iface.

refs #36
parent 7447f259
Branches
Tags
No related merge requests found
......@@ -387,8 +387,7 @@ int remote_bind(conf_iface_t *desc)
int s = socket_create(desc->family, SOCK_STREAM, 0);
if (s < 0) {
log_server_error("Couldn't create socket for remote "
"control interface - %s",
knot_strerror(s));
"control interface - %s", knot_strerror(s));
return KNOT_ERROR;
}
......@@ -398,10 +397,8 @@ int remote_bind(conf_iface_t *desc)
r = socket_listen(s, TCP_BACKLOG_SIZE);
}
if (r != KNOT_EOK) {
log_server_error("Could not bind to remote control interface.\n");
socket_close(s);
log_server_error("Could not bind to "
"remote control interface %s port %d.\n",
desc->address, desc->port);
return r;
}
......
......@@ -306,9 +306,13 @@ int main(int argc, char **argv)
conf_iface_t *ctl_if = conf()->ctl.iface;
int remote = -1;
if (ctl_if != NULL) {
memset(buf, 0, buflen);
if (ctl_if->port)
snprintf((char*)buf, buflen, "@%d", ctl_if->port);
/* Log control interface description. */
log_server_info("Binding remote control interface "
"to %s@%d.\n",
ctl_if->address, ctl_if->port);
"to %s%s\n",
ctl_if->address, (char*)buf);
remote = remote_bind(ctl_if);
}
if (remote < 0)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment