logfile_mod_udp_open() mistreated successful comm_connect_addr() result
as an "Unable to connect" failure (and vice versa), rendering UDP-based
logging unusable. Broken since at least 2010 commit
d938215.
Also fixed logfile_mod_udp_close() closing FD 0 after "Invalid UDP
logging address" ERRORs during logfile_mod_udp_open().
lf->f_rotate = logfile_mod_udp_rotate;
l_udp_t *ll = static_cast<l_udp_t*>(xcalloc(1, sizeof(*ll)));
+ ll->fd = -1;
lf->data = ll;
if (strncmp(path, "//", 2) == 0) {
debugs(50, DBG_IMPORTANT, "ERROR: Unable to open UDP socket for logging");
return FALSE;
}
- } else if (!comm_connect_addr(ll->fd, addr)) {
+ } else if (comm_connect_addr(ll->fd, addr) == Comm::COMM_ERROR) {
xerrno = errno;
if (lf->flags.fatal) {
fatalf("Unable to connect to %s for UDP log: %s\n", lf->path, xstrerr(xerrno));