#include "net.h"
#include "fd.h"
#include "sched.h"
+#include "close_on_fork.h"
/** Convert in_addr to ascii. */
{
PARA_NOTICE_LOG("deleting %s:%d (%s) from list\n", TARGET_ADDR(ut),
ut->port, msg);
- if (ut->fd >= 0)
+ if (ut->fd >= 0) {
close(ut->fd);
+ del_close_on_fork_list(ut->fd);
+ }
list_del(&ut->node);
free(ut);
}
return ret;
ut->fd = ret;
ret = mark_fd_nonblocking(ut->fd);
- if (ret < 0)
+ if (ret < 0) {
close(ut->fd);
- return ret;
+ return ret;
+ }
+ add_close_on_fork_list(ut->fd);
+ return 1;
}
static void udp_shutdown_targets(void)
continue;
write(ut->fd, buf, UDP_AUDIO_HEADER_LEN);
close(ut->fd);
+ del_close_on_fork_list(ut->fd);
ut->fd = -1;
}
}