X-Git-Url: https://gitweb.dragonflybsd.org/~lentferj/dragonfly.git/blobdiff_plain/46e6e9ad0fac7127ec289c43e0becb330e9fca27..4facd0d37192a06dd40016961f8d6a113f45318d:/usr.sbin/pflogd/pflogd.c diff --git a/usr.sbin/pflogd/pflogd.c b/usr.sbin/pflogd/pflogd.c index 8872c89db2..c799a4edb7 100644 --- a/usr.sbin/pflogd/pflogd.c +++ b/usr.sbin/pflogd/pflogd.c @@ -397,7 +397,7 @@ dump_packet_nobuf(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) if (fwrite(h, sizeof(*h), 1, f) != 1) { /* try to undo header to prevent corruption */ off_t pos = ftello(f); - if (pos < sizeof(*h) || + if ((size_t)pos < sizeof(*h) || ftruncate(fileno(f), pos - sizeof(*h))) { logmsg(LOG_ERR, "Write failed, corrupted logfile!"); set_suspended(1);