Don't register IOCTLs with capsicum when there is no valid file descriptor.

This fixes tcpdump when using mlx5_X devices.

Differential Revision:	https://reviews.freebsd.org/D18499
Reviewed by:		kib@, slavash@, oshogbo@
MFC after:		1 week
Sponsored by:		Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2018-12-12 09:51:10 +00:00
parent 23c25bd8b1
commit 46caeeca78

View File

@ -1915,7 +1915,7 @@ main(int argc, char **argv)
if (pcap_setfilter(pd, &fcode) < 0)
error("%s", pcap_geterr(pd));
#ifdef HAVE_CAPSICUM
if (RFileName == NULL && VFileName == NULL) {
if (RFileName == NULL && VFileName == NULL && pcap_fileno(pd) != -1) {
static const unsigned long cmds[] = { BIOCGSTATS, BIOCROTZBUF };
/*