summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-01-18 20:50:06 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-01-18 20:50:06 +0000
commit203e8d81fd084b68803da38a7deb717f386d322d (patch)
tree991181007a0eabd8782a426af4998eaf5f26db99
parentefcbdd9256426c6916662c08961d16fa84c1ce95 (diff)
Formerly dir-readdir.c.~2~
-rw-r--r--libnetfs/dir-readdir.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libnetfs/dir-readdir.c b/libnetfs/dir-readdir.c
index 3115dc95..7b55a2cc 100644
--- a/libnetfs/dir-readdir.c
+++ b/libnetfs/dir-readdir.c
@@ -39,11 +39,14 @@ netfs_S_dir_readdir (struct protid *user,
np = user->po->np;
mutex_lock (&np->lock);
- err = netfs_validate_stat (user->credential, np);
+ if ((user->po->openstat & O_READ) == 0)
+ err = EBADF;
+ if (!err)
+ err = netfs_validate_stat (user->credential, np);
if (!err && (np->dn_stat.st_mode & S_IFMT) != S_IFDIR)
err = ENOTDIR;
if (!err)
- err = netfs_get_directs (user->credential, np, entry, nentries, data
+ err = netfs_get_directs (user->credential, np, entry, nentries, data,
datacnt, bufsiz, amt);
mutex_unlock (&np->lock);
return err;