From d780f1b47cf9248eb11a0bce9bcdaf4e163525e3 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 9 Mar 2015 15:34:03 -0700 Subject: [PATCH] Clean up Capsicum rights setting a bit. Rename set_dump_fd_capsicum_rights() to set_dumper_capsicum_rights() and have it take a pcap_dumper_t * as an argument and extract the file descriptor itself, rather than having the caller do so. This fixes a syntax error in one of the calls. --- tcpdump.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tcpdump.c b/tcpdump.c index 3803fd94..2b71d27d 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -980,8 +980,9 @@ tstamp_precision_to_string(int precision) * what the standard I/O library happens to require this week. */ static void -set_dump_fd_capsicum_rights(int fd) +set_dumper_capsicum_rights(pcap_dumper_t *p) { + int fd = fileno(pcap_dump_file(p)); cap_rights_t rights; cap_rights_init(&rights, CAP_SEEK, CAP_WRITE, CAP_FCNTL); @@ -1894,7 +1895,7 @@ main(int argc, char **argv) if (p == NULL) error("%s", pcap_geterr(pd)); #ifdef HAVE_CAPSICUM - set_dump_fd_capsicum_rights(fileno(pcap_dump_file(p))); + set_dumper_capsicum_rights(p); #endif if (Cflag != 0 || Gflag != 0) { #ifdef HAVE_CAPSICUM @@ -2329,7 +2330,7 @@ dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *s if (dump_info->p == NULL) error("%s", pcap_geterr(pd)); #ifdef HAVE_CAPSICUM - set_dump_fd_capsicum_rights(pcap_dump_file(dump_info->p))); + set_dumper_capsicum_rights(dump_info->p); #endif } } @@ -2400,7 +2401,7 @@ dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *s if (dump_info->p == NULL) error("%s", pcap_geterr(pd)); #ifdef HAVE_CAPSICUM - set_dump_fd_capsicum_rights(fileno(pcap_dump_file(dump_info->p))); + set_dumper_capsicum_rights(dump_info->p); #endif } } -- 2.39.5