diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-04-10 17:35:41 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-04-10 17:35:41 +0000 |
commit | 1f956d74641a0262fd79c0ddf201219555a1076d (patch) | |
tree | fb9f5bc5e0fbfbc9edf46682f2e4f1c147259f37 /sys | |
parent | a0c1d0ea9ede7a357d343334855ce96934e3ebfd (diff) |
Don't seg-fault on file systems that don't support cookies. Thanks to
Jason Ish for finding this one.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/common/compat_dir.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/compat/common/compat_dir.c b/sys/compat/common/compat_dir.c index e7ecbd1e53f..74afaf81e36 100644 --- a/sys/compat/common/compat_dir.c +++ b/sys/compat/common/compat_dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compat_dir.c,v 1.1 2001/01/23 05:48:04 csapuntz Exp $ */ +/* $OpenBSD: compat_dir.c,v 1.2 2001/04/10 17:35:40 csapuntz Exp $ */ /* * Copyright (c) 2000 Constantine Sapuntzakis @@ -52,7 +52,7 @@ readdir_with_callback(fp, off, nbytes, appendfunc, arg) int buflen; struct uio auio; struct iovec aiov; - int eofflag; + int eofflag = 0; u_long *cookiebuf = NULL, *cookie; int ncookies = 0; int error, len, reclen; @@ -94,14 +94,14 @@ again: if (error) goto out; - if (!cookiebuf && !eofflag) { + if ((len = buflen - auio.uio_resid) == 0) + goto eof; + + if (cookiebuf == NULL) { error = EPERM; goto out; } - if ((len = buflen - auio.uio_resid) == 0) - goto eof; - cookie = cookiebuf; inp = buf; |