aboutgitcodebugslistschat
path: root/pcap.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-06-17 11:55:04 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-06-21 15:32:44 +0200
commitdba7f0f5cee06dcfc205b0284ba19c2651f594c4 (patch)
tree94e8aea617e0e611bdca363e301038b2c47fa129 /pcap.c
parent92a22fef93a528030669e357a32c19f143a2d3b5 (diff)
downloadpasst-dba7f0f5cee06dcfc205b0284ba19c2651f594c4.tar
passt-dba7f0f5cee06dcfc205b0284ba19c2651f594c4.tar.gz
passt-dba7f0f5cee06dcfc205b0284ba19c2651f594c4.tar.bz2
passt-dba7f0f5cee06dcfc205b0284ba19c2651f594c4.tar.lz
passt-dba7f0f5cee06dcfc205b0284ba19c2651f594c4.tar.xz
passt-dba7f0f5cee06dcfc205b0284ba19c2651f594c4.tar.zst
passt-dba7f0f5cee06dcfc205b0284ba19c2651f594c4.zip
treewide: Replace strerror() calls
Now that we have logging functions embedding perror() functionality, we can make _some_ calls more terse by using them. In many places, the strerror() calls are still more convenient because, for example, they are used in flow debugging functions, or because the return code variable of interest is not 'errno'. While at it, convert a few error messages from a scant perror style to proper failure descriptions. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'pcap.c')
-rw-r--r--pcap.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/pcap.c b/pcap.c
index 507be2a..46cc4b0 100644
--- a/pcap.c
+++ b/pcap.c
@@ -89,10 +89,8 @@ static void pcap_frame(const struct iovec *iov, size_t iovcnt,
struct iovec hiov = { &h, sizeof(h) };
if (write_remainder(pcap_fd, &hiov, 1, 0) < 0 ||
- write_remainder(pcap_fd, iov, iovcnt, offset) < 0) {
- debug("Cannot log packet, length %zu: %s",
- l2len, strerror(errno));
- }
+ write_remainder(pcap_fd, iov, iovcnt, offset) < 0)
+ debug_perror("Cannot log packet, length %zu", l2len);
}
/**
@@ -178,5 +176,5 @@ void pcap_init(struct ctx *c)
info("Saving packet capture to %s", c->pcap);
if (write(pcap_fd, &pcap_hdr, sizeof(pcap_hdr)) < 0)
- warn("Cannot write PCAP header: %s", strerror(errno));
+ warn_perror("Cannot write PCAP header");
}