addr.sin_addr.s_addr = config->cli_bind_address; /* defaults to INADDR_ANY */
addr.sin_port = htons(23);
if (bind(clifd, (void *) &addr, sizeof(addr)) < 0)
+ {
+ LOG(0, 0, 0, "Error binding cli on port 23: %s\n", strerror(errno));
+ close(clifd);
+ clifd = -1;
+ return;
+ }
+ if (listen(clifd, 10) < 0)
{
LOG(0, 0, 0, "Error listening on cli port 23: %s\n", strerror(errno));
+ close(clifd);
+ clifd = -1;
return;
}
- listen(clifd, 10);
}
void cli_do(int sockfd)