aboutgitcodebugslistschat
path: root/pcap.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap.c')
-rw-r--r--pcap.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/pcap.c b/pcap.c
index 6ee6cdf..2e2ff93 100644
--- a/pcap.c
+++ b/pcap.c
@@ -158,18 +158,15 @@ void pcap_iov(const struct iovec *iov, size_t iovcnt, size_t offset)
*/
void pcap_init(struct ctx *c)
{
- int flags = O_WRONLY | O_CREAT | O_TRUNC;
-
if (pcap_fd != -1)
return;
if (!*c->pcap)
return;
- flags |= c->foreground ? O_CLOEXEC : 0;
- pcap_fd = open(c->pcap, flags, S_IRUSR | S_IWUSR);
+ pcap_fd = output_file_open(c->pcap, O_WRONLY);
if (pcap_fd == -1) {
- perror("open");
+ err_perror("Couldn't open pcap file %s", c->pcap);
return;
}