Fix the "passability" test in fdcopy().
Rather than checking to see if a descriptor is a kqueue, check to see if its fileops flags include DFLAG_PASSABLE. At the moment, these two tests are equivalent, but this will change with the addition of capabilities that wrap kqueues but are themselves of type DTYPE_CAPABILITY. We already have the DFLAG_PASSABLE abstraction, so let's use it. This change has been tested with [the newly improved] tools/regression/kqueue. Approved by: mentor (rwatson), re (Capsicum blanket) Sponsored by: Google Inc
This commit is contained in:
parent
f07a2b912b
commit
7c2c726167
@ -1780,11 +1780,11 @@ fdcopy(struct filedesc *fdp)
|
||||
FILEDESC_XUNLOCK(newfdp);
|
||||
FILEDESC_SLOCK(fdp);
|
||||
}
|
||||
/* copy everything except kqueue descriptors */
|
||||
/* copy all passable descriptors (i.e. not kqueue) */
|
||||
newfdp->fd_freefile = -1;
|
||||
for (i = 0; i <= fdp->fd_lastfile; ++i) {
|
||||
if (fdisused(fdp, i) &&
|
||||
fdp->fd_ofiles[i]->f_type != DTYPE_KQUEUE &&
|
||||
(fdp->fd_ofiles[i]->f_ops->fo_flags & DFLAG_PASSABLE) &&
|
||||
fdp->fd_ofiles[i]->f_ops != &badfileops) {
|
||||
newfdp->fd_ofiles[i] = fdp->fd_ofiles[i];
|
||||
newfdp->fd_ofileflags[i] = fdp->fd_ofileflags[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user