diff options
author | 2018-03-27 08:27:29 +0000 | |
---|---|---|
committer | 2018-03-27 08:27:29 +0000 | |
commit | 9b49758e0b45aa03c8980e1c70bd632c3bc7489d (patch) | |
tree | 750c810b6b990cfb32388c1993e442d140f2e62c | |
parent | Exclude SIGKILL from ptrace(2) interception. (diff) | |
download | wireguard-openbsd-9b49758e0b45aa03c8980e1c70bd632c3bc7489d.tar.xz wireguard-openbsd-9b49758e0b45aa03c8980e1c70bd632c3bc7489d.zip |
Use a goto to merge multiple error blocks in sosplice().
ok bluhm@
-rw-r--r-- | sys/kern/uipc_socket.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index f13f25fc459..7d125c7869c 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.218 2018/03/01 14:11:11 bluhm Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.219 2018/03/27 08:27:29 mpi Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -1141,13 +1141,11 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv) /* Lock both receive and send buffer. */ if ((error = sblock(so, &so->so_rcv, (so->so_state & SS_NBIO) ? M_NOWAIT : M_WAITOK)) != 0) { - FRELE(fp, curproc); - return (error); + goto frele; } if ((error = sblock(so, &sosp->so_snd, M_WAITOK)) != 0) { sbunlock(so, &so->so_rcv); - FRELE(fp, curproc); - return (error); + goto frele; } if (so->so_sp->ssp_socket || sosp->so_sp->ssp_soback) { @@ -1191,6 +1189,7 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv) release: sbunlock(sosp, &sosp->so_snd); sbunlock(so, &so->so_rcv); + frele: FRELE(fp, curproc); return (error); } |