+ /*
+ * Save the name and port of the accepting socket for later lookup.
+ *
+ * The string needs space for strlen(...) + 7 characters:
+ * strlen(haddr[i]) + 1 (':') + 5 (port digits) + 1 ('\0')
+ */
+ listen_addr_size = strlen(csp->config->haddr[i]) + 7;
+ csp->listen_addr_str = malloc_or_die(listen_addr_size);
+ retval = snprintf(csp->listen_addr_str, listen_addr_size,
+ "%s:%d", csp->config->haddr[i], csp->config->hport[i]);
+ if ((-1 == retval) || listen_addr_size <= retval)
+ {
+ log_error(LOG_LEVEL_ERROR,
+ "Server name (%s) and port number (%d) ASCII decimal representation"
+ "don't fit into %d bytes",
+ csp->config->haddr[i], csp->config->hport[i], listen_addr_size);
+ return 0;
+ }
+