diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-10-06 20:23:17 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-10-06 20:23:17 +0000 |
commit | 85674180ac0b414993bec634994ea51b28390306 (patch) | |
tree | 5ce384dfed739e368b8605fc6db4ed1f26a43609 /sys/compat/sunos/sunos_misc.c | |
parent | 44f83f3e77b70fbce9f014e39cf5c97bae700213 (diff) |
back out vfs lite2 till after 2.2
Diffstat (limited to 'sys/compat/sunos/sunos_misc.c')
-rw-r--r-- | sys/compat/sunos/sunos_misc.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/compat/sunos/sunos_misc.c b/sys/compat/sunos/sunos_misc.c index e062dbf9c80..b17091d236a 100644 --- a/sys/compat/sunos/sunos_misc.c +++ b/sys/compat/sunos/sunos_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sunos_misc.c,v 1.12 1997/10/06 15:05:45 csapuntz Exp $ */ +/* $OpenBSD: sunos_misc.c,v 1.13 1997/10/06 20:19:33 deraadt Exp $ */ /* $NetBSD: sunos_misc.c,v 1.65 1996/04/22 01:44:31 christos Exp $ */ /* @@ -412,7 +412,7 @@ sunos_sys_getdents(p, v, retval) struct sunos_dirent idb; off_t off; /* true file offset */ int buflen, error, eofflag; - u_long *cookiebuf = NULL, *cookie; + u_long *cookiebuf, *cookie; int ncookies; if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) @@ -428,6 +428,8 @@ sunos_sys_getdents(p, v, retval) buflen = min(MAXBSIZE, SCARG(uap, nbytes)); buf = malloc(buflen, M_TEMP, M_WAITOK); + ncookies = buflen / 16; + cookiebuf = malloc(ncookies * sizeof(*cookiebuf), M_TEMP, M_WAITOK); VOP_LOCK(vp); off = fp->f_offset; again: @@ -444,15 +446,10 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, - &ncookies, &cookiebuf); + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, cookiebuf, + ncookies); if (error) goto out; - - if (!error && !cookiebuf) { - error = EPERM; - goto out; - } inp = buf; outp = SCARG(uap, buf); @@ -504,8 +501,7 @@ eof: *retval = SCARG(uap, nbytes) - resid; out: VOP_UNLOCK(vp); - if (cookiebuf) - free(cookiebuf, M_TEMP); + free(cookiebuf, M_TEMP); free(buf, M_TEMP); return (error); } |