return True;
}
+void udp_destroy_socket(struct udpcommon *uc, struct udpsock *us)
+{
+ if (us->fd>=0) {
+ close(us->fd);
+ us->fd=-1;
+ }
+}
+
bool_t udp_make_socket(struct udpcommon *uc, struct udpsock *us,
int failmsgclass)
{
us->fd=socket(addr->sa.sa_family, SOCK_DGRAM, IPPROTO_UDP);
if (us->fd<0) FAIL("socket");
- if (fcntl(us->fd, F_SETFL, fcntl(us->fd, F_GETFL)|O_NONBLOCK)==-1)
- FAIL("fcntl(set O_NONBLOCK)");
+ setnonblock(us->fd);
setcloexec(us->fd);
#ifdef CONFIG_IPV6
if (addr->sa.sa_family==AF_INET6) {
char *argv[5], addrstr[33], portstr[5];
const char *addrfam;
int port;
+ afterfork();
switch (addr->sa.sa_family) {
case AF_INET:
sprintf(addrstr,"%08lX",(long)addr->sin.sin_addr.s_addr);
FAIL("waitpid for authbind");
}
if (status) {
- lg_exitstatus(FAIL_LG,status,"authbind");
+ if (WIFEXITED(status) && WEXITSTATUS(status)<127) {
+ int es=WEXITSTATUS(status);
+ lg_perror(FAIL_LG,es,
+ "authbind exited with error exit status %d;"
+ " indicates error",es);
+ } else {
+ lg_exitstatus(FAIL_LG,status,"authbind");
+ }
goto failed;
}
} else {
return True;
failed:
- if (us->fd>=0) {
- close(us->fd);
- us->fd=-1;
- }
+ udp_destroy_socket(uc,us);
return False;
#undef FAIL