freebsd-nq/sys/contrib/libnv
Mark Johnston 991666adc7 Ensure that libnv can be used when kern.trap_enotcap=1.
libnv used fcntl(fd, F_GETFL) to test whether fd is a valid file
descriptor.  Aside from being racy, this check requires CAP_FCNTL
rights on fd.  Instead, use fcntl(fd, F_GETFD), which does not require
any capability rights.

Also remove some redundant fd_is_valid() checks to avoid extra system
calls; in many cases we were performing this check immediately before
dup()ing the descriptor.

Reviewed by:	cem, oshogbo (previous version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17963
2018-11-13 20:07:55 +00:00
..
cnvlist.c libnv: Remove nvlist argument from cnvlist_{take,free}_* functions. 2018-06-18 21:26:58 +00:00
dnvlist.c Add SPDX tags for nv(9). 2018-01-27 12:58:21 +00:00
nv_impl.h libnv: Add nvlist_append_*_array() family of functions. 2018-06-18 22:57:32 +00:00
nvlist_impl.h Add SPDX tags for nv(9). 2018-01-27 12:58:21 +00:00
nvlist.c libnv: Add nvlist_append_*_array() family of functions. 2018-06-18 22:57:32 +00:00
nvpair_impl.h Add SPDX tags for nv(9). 2018-01-27 12:58:21 +00:00
nvpair.c Ensure that libnv can be used when kern.trap_enotcap=1. 2018-11-13 20:07:55 +00:00