summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 3082aea..cf4eced 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -2336,6 +2336,16 @@ _fget(struct thread *td, int fd, struct file **fpp, int flags,
#ifdef CAPABILITIES
/*
+ * If this is a capability, what rights does it have?
+ */
+ if (haverightsp != NULL) {
+ if (fp->f_type == DTYPE_CAPABILITY)
+ *haverightsp = cap_rights(fp);
+ else
+ *haverightsp = CAP_MASK_VALID;
+ }
+
+ /*
* If a capability has been requested, return the capability directly.
* Otherwise, check capability rights, extract the underlying object,
* and check its access flags.
OpenPOWER on IntegriCloud