Skip to content

Commit

Permalink
When we are closing capability during dup2(), we want to call mq_fdcl…
Browse files Browse the repository at this point in the history
…ose()

on the underlying object and not on the capability itself.

Discussed with:	rwatson
Sponsored by:	FreeBSD Foundation
MFC after:	1 month
  • Loading branch information
Pawel Jakub Dawidek authored and Pawel Jakub Dawidek committed Jun 10, 2012
1 parent 5877145 commit 69d7614
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sys/kern/kern_descrip.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,8 +922,13 @@ do_dup(struct thread *td, int flags, int old, int new,
*/
if (delfp != NULL) {
knote_fdclose(td, new);
if (delfp->f_type == DTYPE_MQUEUE)
mq_fdclose(td, new, delfp);
/*
* When we're closing an fd with a capability, we need to
* notify mqueue if the underlying object is of type mqueue.
*/
(void)cap_funwrap(delfp, 0, &fp);
if (fp->f_type == DTYPE_MQUEUE)
mq_fdclose(td, new, fp);
FILEDESC_XUNLOCK(fdp);
(void) closef(delfp, td);
if (holdleaders) {
Expand Down

0 comments on commit 69d7614

Please sign in to comment.