Merge pull request #58 from wllm-rbnt/dev

Add support for pcap output to FIFO
This commit is contained in:
Alexandre Dulaunoy 2021-07-21 23:09:39 +02:00 committed by GitHub
commit deb2566496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,7 +219,12 @@ logpkt_pcap_open_fd(int fd) {
pcap_file_hdr_t hdr; pcap_file_hdr_t hdr;
off_t sz; off_t sz;
ssize_t n; ssize_t n;
struct stat st;
if(fstat(fd, &st))
return -1;
if(!S_ISFIFO(st.st_mode)) {
sz = lseek(fd, 0, SEEK_END); sz = lseek(fd, 0, SEEK_END);
if (sz == -1) if (sz == -1)
return -1; return -1;
@ -237,7 +242,7 @@ logpkt_pcap_open_fd(int fd) {
if (ftruncate(fd, 0) == -1) if (ftruncate(fd, 0) == -1)
return -1; return -1;
} }
}
return logpkt_write_global_pcap_hdr(fd); return logpkt_write_global_pcap_hdr(fd);
} }