- else
- {
- if ((spamd_sock = ip_socket(SOCK_STREAM, AF_INET)) < 0)
- {
- log_write(0, LOG_MAIN|LOG_PANIC,
- "%s error creating IP socket for spamd", loglabel);
- goto defer;
- }
-
- /*XXX should we use getaddrinfo? */
- if (!(he = gethostbyname(CS this_spamd->hostname)))
- log_write(0, LOG_MAIN|LOG_PANIC,
- "%s failed to lookup host '%s'", loglabel, this_spamd->hostname);
-
- else
- {
- struct in_addr in = *(struct in_addr *) he->h_addr_list[0];
-
- if (ip_connect(spamd_sock, AF_INET, US inet_ntoa(in),
- this_spamd->tcp_port, 5) > -1)
- break; /* connection OK */
-
- log_write(0, LOG_MAIN,
- "%s warning - spamd connection to '%s', port %u failed: %s",
- loglabel,
- this_spamd->hostname, this_spamd->tcp_port, strerror(errno));
- }