aboutgitcodebugslistschat
path: root/conf.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 /conf.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 'conf.c')
-rw-r--r--conf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/conf.c b/conf.c
index 1d1f9a1..3db8d4d 100644
--- a/conf.c
+++ b/conf.c
@@ -461,7 +461,7 @@ static void get_dns(struct ctx *c)
}
if (line_len < 0)
- warn("Error reading /etc/resolv.conf: %s", strerror(errno));
+ warn_perror("Error reading /etc/resolv.conf");
close(fd);
out:
@@ -623,6 +623,7 @@ static unsigned int conf_ip4(unsigned int ifi,
int rc = nl_link_get_mac(nl_sock, ifi, mac);
if (rc < 0) {
char ifname[IFNAMSIZ];
+
err("Couldn't discover MAC address for %s: %s",
if_indextoname(ifi, ifname), strerror(-rc));
return 0;
@@ -1496,8 +1497,7 @@ void conf(struct ctx *c, int argc, char **argv)
break;
case 'i':
if (!(ifi4 = ifi6 = if_nametoindex(optarg)))
- die("Invalid interface name %s: %s", optarg,
- strerror(errno));
+ die_perror("Invalid interface name %s", optarg);
break;
case 'o':
if (inet_pton(AF_INET6, optarg, &c->ip6.addr_out) &&