This allows libfetch to close cached sockets.
Also add cast that helped FreeBSD move warns to 6
Taken-from: FreeBSD SVN 221822 (12 May 2011)
Taken-from: FreeBSD SVN 221830 (13 May 2011)
/* allocate and fill connection structure */
if ((conn = calloc(1, sizeof(*conn))) == NULL)
return (NULL);
+ fcntl(sd, F_SETFD, FD_CLOEXEC);
conn->sd = sd;
++conn->ref;
return (conn);
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/lib/libfetch/file.c,v 1.18 2007/12/14 10:26:58 des Exp $
- * $DragonFly: src/lib/libfetch/file.c,v 1.3 2007/08/05 21:48:12 swildner Exp $
*/
#include <sys/param.h>
#include <sys/stat.h>
#include <dirent.h>
+#include <fcntl.h>
#include <stdio.h>
#include <string.h>
fetch_syserr();
}
+ fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
return (f);
}
fetch_syserr();
}
+ fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
return (f);
}
!IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
return;
sin4 = (struct sockaddr_in *)sin6;
- addr = *(u_int32_t *)&sin6->sin6_addr.s6_addr[12];
+ addr = *(u_int32_t *)(uintptr_t)&sin6->sin6_addr.s6_addr[12];
port = sin6->sin6_port;
memset(sin4, 0, sizeof(struct sockaddr_in));
sin4->sin_addr.s_addr = addr;