diff options
Diffstat (limited to 'sys/compat/svr4/svr4_fcntl.c')
-rw-r--r-- | sys/compat/svr4/svr4_fcntl.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/compat/svr4/svr4_fcntl.c b/sys/compat/svr4/svr4_fcntl.c index 189e3744886..c8badb3394a 100644 --- a/sys/compat/svr4/svr4_fcntl.c +++ b/sys/compat/svr4/svr4_fcntl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_fcntl.c,v 1.20 2002/02/02 16:05:58 art Exp $ */ +/* $OpenBSD: svr4_fcntl.c,v 1.21 2002/02/13 19:08:06 art Exp $ */ /* $NetBSD: svr4_fcntl.c,v 1.14 1995/10/14 20:24:24 christos Exp $ */ /* @@ -272,8 +272,10 @@ fd_truncate(p, fd, flp, retval) if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) return ESPIPE; + FREF(fp); + if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0) - return error; + goto out; length = vattr.va_size; @@ -291,18 +293,23 @@ fd_truncate(p, fd, flp, retval) break; default: - return EINVAL; + error = EINVAL; + goto out; } if (start + flp->l_len < length) { /* We don't support free'ing in the middle of the file */ - return EINVAL; + error = EINVAL; + goto out; } SCARG(&ft, fd) = fd; SCARG(&ft, length) = start; - return sys_ftruncate(p, &ft, retval); + error = sys_ftruncate(p, &ft, retval); +out: + FRELE(fp); + return (error); } int @@ -338,9 +345,11 @@ svr4_sys_open(p, v, retval) if ((fp = fd_getfile(fdp, *retval)) == NULL) return (EBADF); + FREF(fp); /* ignore any error, just give it a try */ if (fp->f_type == DTYPE_VNODE) (fp->f_ops->fo_ioctl) (fp, TIOCSCTTY, (caddr_t) 0, p); + FRELE(fp); } return 0; } |