fd: don't unnecessary copy capabilities in _fget

This commit is contained in:
Mateusz Guzik 2015-06-16 09:08:30 +00:00
parent 9c5682ed70
commit 80f3623f2f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=284442

View File

@ -2433,11 +2433,9 @@ _fget(struct thread *td, int fd, struct file **fpp, int flags,
*fpp = NULL;
fdp = td->td_proc->p_fd;
if (needrightsp != NULL)
needrights = *needrightsp;
else
cap_rights_init(&needrights);
error = fget_unlocked(fdp, fd, &needrights, &fp, seqp);
if (needrightsp == NULL)
needrightsp = cap_rights_init(&needrights);
error = fget_unlocked(fdp, fd, needrightsp, &fp, seqp);
if (error != 0)
return (error);
if (fp->f_ops == &badfileops) {