summaryrefslogtreecommitdiff
path: root/sys/compat/hpux
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-08-23 22:21:45 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-08-23 22:21:45 +0000
commit9958388d0a4d2166f3f7b1acfaae96e99f8843b7 (patch)
treeab1d7cfaa82b05c8b9df1d55216c6a854b15a50c /sys/compat/hpux
parentb384e85014c8970773b255f11530482e7110ccfb (diff)
Just like getvnode, make getsock FREF the file so that we can't get away
with not refing it. Eyeballed by lurene@daemonkitty.net, fries@, nordin@ and fries@ Some additional cleanups by nordin@
Diffstat (limited to 'sys/compat/hpux')
-rw-r--r--sys/compat/hpux/hpux_net.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sys/compat/hpux/hpux_net.c b/sys/compat/hpux/hpux_net.c
index d7280311938..50354b2d45b 100644
--- a/sys/compat/hpux/hpux_net.c
+++ b/sys/compat/hpux/hpux_net.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hpux_net.c,v 1.8 2002/03/14 01:26:49 millert Exp $ */
+/* $OpenBSD: hpux_net.c,v 1.9 2002/08/23 22:21:43 art Exp $ */
/* $NetBSD: hpux_net.c,v 1.14 1997/04/01 19:59:02 scottr Exp $ */
/*
@@ -214,16 +214,16 @@ hpux_sys_setsockopt(p, v, retval)
if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)))
return (error);
- if (SCARG(uap, valsize) > MLEN)
- return (EINVAL);
- FREF(fp);
+ if (SCARG(uap, valsize) > MLEN) {
+ error = EINVAL;
+ goto bad;
+ }
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)))) {
- FRELE(fp);
(void) m_free(m);
- return (error);
+ goto bad;
}
if (SCARG(uap, name) == SO_LINGER) {
tmp = *mtod(m, int *);
@@ -240,6 +240,7 @@ hpux_sys_setsockopt(p, v, retval)
}
error = sosetopt((struct socket *)fp->f_data, SCARG(uap, level),
SCARG(uap, name), m);
+bad:
FRELE(fp);
return (error);
}
@@ -258,21 +259,22 @@ hpux_sys_setsockopt2(p, v, retval)
if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)))
return (error);
- if (SCARG(uap, valsize) > MLEN)
- return (EINVAL);
- FREF(fp);
+ if (SCARG(uap, valsize) > MLEN) {
+ error = EINVAL;
+ goto bad;
+ }
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)))) {
- FRELE(fp);
- (void) m_free(m);
- return (error);
+ m_free(m);
+ goto bad;
}
socksetsize(SCARG(uap, valsize), m);
}
error = sosetopt((struct socket *)fp->f_data, SCARG(uap, level),
SCARG(uap, name), m);
+bad:
FRELE(fp);
return (error);
}
@@ -290,12 +292,10 @@ hpux_sys_getsockopt(p, v, retval)
if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)))
return (error);
- FREF(fp);
if (SCARG(uap, val)) {
if ((error = copyin((caddr_t)SCARG(uap, avalsize),
(caddr_t)&valsize, sizeof (valsize)))) {
- FRELE(fp);
- return (error);
+ goto bad;
}
} else
valsize = 0;
@@ -321,6 +321,6 @@ hpux_sys_getsockopt(p, v, retval)
bad:
FRELE(fp);
if (m != NULL)
- (void) m_free(m);
+ m_free(m);
return (error);
}