diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-12 13:05:33 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-12 13:05:33 +0000 |
commit | 8b08ca52ce00cfd942606cbd6b616b85ca682d3f (patch) | |
tree | 7ee8adff016b64c02b113fe28bd2af5bd879580e /sys/compat/ultrix/ultrix_misc.c | |
parent | 73693552d13e63640043dc3768acb73e9cddb534 (diff) |
Fix all users of getsock to use FREF/FRELE properly.
Diffstat (limited to 'sys/compat/ultrix/ultrix_misc.c')
-rw-r--r-- | sys/compat/ultrix/ultrix_misc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/compat/ultrix/ultrix_misc.c b/sys/compat/ultrix/ultrix_misc.c index c84f4dbed79..8e46acd843f 100644 --- a/sys/compat/ultrix/ultrix_misc.c +++ b/sys/compat/ultrix/ultrix_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ultrix_misc.c,v 1.22 2001/11/06 19:53:18 miod Exp $ */ +/* $OpenBSD: ultrix_misc.c,v 1.23 2002/02/12 13:05:31 art Exp $ */ /* $NetBSD: ultrix_misc.c,v 1.23 1996/04/07 17:23:04 jonathan Exp $ */ /* @@ -353,27 +353,35 @@ ultrix_sys_setsockopt(p, v, retval) if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); + FREF(fp); #define SO_DONTLINGER (~SO_LINGER) if (SCARG(uap, name) == SO_DONTLINGER) { m = m_get(M_WAIT, MT_SOOPTS); mtod(m, struct linger *)->l_onoff = 0; m->m_len = sizeof(struct linger); - return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + error = (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), SO_LINGER, m)); + FRELE(fp); + return (error); } - if (SCARG(uap, valsize) > MLEN) + if (SCARG(uap, valsize) > MLEN) { + FRELE(fp); return (EINVAL); + } if (SCARG(uap, val)) { m = m_get(M_WAIT, MT_SOOPTS); if ((error = copyin(SCARG(uap, val), mtod(m, caddr_t), (u_int)SCARG(uap, valsize))) != 0) { + FRELE(fp); (void) m_free(m); return (error); } m->m_len = SCARG(uap, valsize); } - return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + error = (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), SCARG(uap, name), m)); + FRELE(fp); + return (error); } struct ultrix_utsname { |