summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-01-18 19:30:07 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-01-18 19:30:07 +0000
commitefcbdd9256426c6916662c08961d16fa84c1ce95 (patch)
tree73a9b2b0aa82282db682244f44bb77201bca7578 /libdiskfs
parent9c1fb7615cfd785ce5bb396371bc38d015dc194b (diff)
(diskfs_S_dir_readdir): Require read permission before succeeding.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/dir-readdir.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libdiskfs/dir-readdir.c b/libdiskfs/dir-readdir.c
index c4a6dd12..23e24213 100644
--- a/libdiskfs/dir-readdir.c
+++ b/libdiskfs/dir-readdir.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1993, 1994, 1996 Free Software Foundation
This file is part of the GNU Hurd.
@@ -39,6 +39,13 @@ diskfs_S_dir_readdir (struct protid *cred,
np = cred->po->np;
mutex_lock (&np->lock);
+
+ if ((cred->po->openstat & O_READ) == 0)
+ {
+ mutex_unlock (&np->lock);
+ return EBADF;
+ }
+
if ((np->dn_stat.st_mode & S_IFMT) != S_IFDIR)
{
mutex_unlock (&np->lock);