1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-20 15:43:16 +00:00

Use getsock_cap() instead of deprecated fgetsock().

Reviewed by:	Daniel Braniss <danny cs.huji.ac.il>
This commit is contained in:
Gleb Smirnoff 2017-01-13 18:36:46 +00:00
parent d5b937680c
commit f8f24e9ec2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=312081
2 changed files with 5 additions and 12 deletions

View File

@ -680,7 +680,6 @@ isc_stop_receiver(isc_session_t *sp)
if(sp->fp != NULL)
fdrop(sp->fp, sp->td);
fputsock(sp->soc);
sp->soc = NULL;
sp->fp = NULL;

View File

@ -388,20 +388,14 @@ i_setsoc(isc_session_t *sp, int fd, struct thread *td)
if(sp->soc != NULL)
isc_stop_receiver(sp);
error = fget(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT), &sp->fp);
error = getsock_cap(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT),
&sp->fp, NULL, NULL);
if(error)
return error;
error = fgetsock(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT),
&sp->soc, 0);
if(error == 0) {
sp->td = td;
isc_start_receiver(sp);
}
else {
fdrop(sp->fp, td);
sp->fp = NULL;
}
sp->soc = sp->fp->f_data;
sp->td = td;
isc_start_receiver(sp);
return error;
}