common.c (234837) | common.c (236193) |
---|---|
1/*- 2 * Copyright (c) 1998-2011 Dag-Erling Sm��rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1998-2011 Dag-Erling Sm��rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/lib/libfetch/common.c 234837 2012-04-30 12:11:45Z des $"); | 30__FBSDID("$FreeBSD: head/lib/libfetch/common.c 236193 2012-05-28 19:22:23Z jilles $"); |
31 32#include <sys/param.h> 33#include <sys/socket.h> 34#include <sys/time.h> 35#include <sys/uio.h> 36 37#include <netinet/in.h> 38 --- 165 unchanged lines hidden (view full) --- 204 205/* 206 * Create a connection for an existing descriptor. 207 */ 208conn_t * 209fetch_reopen(int sd) 210{ 211 conn_t *conn; | 31 32#include <sys/param.h> 33#include <sys/socket.h> 34#include <sys/time.h> 35#include <sys/uio.h> 36 37#include <netinet/in.h> 38 --- 165 unchanged lines hidden (view full) --- 204 205/* 206 * Create a connection for an existing descriptor. 207 */ 208conn_t * 209fetch_reopen(int sd) 210{ 211 conn_t *conn; |
212 int opt = 1; |
|
212 213 /* allocate and fill connection structure */ 214 if ((conn = calloc(1, sizeof(*conn))) == NULL) 215 return (NULL); 216 fcntl(sd, F_SETFD, FD_CLOEXEC); | 213 214 /* allocate and fill connection structure */ 215 if ((conn = calloc(1, sizeof(*conn))) == NULL) 216 return (NULL); 217 fcntl(sd, F_SETFD, FD_CLOEXEC); |
218 setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof opt); |
|
217 conn->sd = sd; 218 ++conn->ref; 219 return (conn); 220} 221 222 223/* 224 * Bump a connection's reference count. --- 681 unchanged lines hidden --- | 219 conn->sd = sd; 220 ++conn->ref; 221 return (conn); 222} 223 224 225/* 226 * Bump a connection's reference count. --- 681 unchanged lines hidden --- |