summaryrefslogtreecommitdiff
path: root/libnetfs
diff options
context:
space:
mode:
Diffstat (limited to 'libnetfs')
-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;