libsystemd-network: make sd_dhcp_client_get_ifname() or friends return negative errno on error

This commit is contained in:
Yu Watanabe
2021-09-29 03:37:09 +09:00
parent 01afd0f7f5
commit 5977b71f28
27 changed files with 168 additions and 99 deletions
+3 -6
View File
@@ -3,16 +3,13 @@
#include "format-util.h"
#include "network-common.h"
const char *get_ifname(int ifindex, char **ifname) {
int get_ifname(int ifindex, char **ifname) {
assert(ifname);
/* This sets ifname only when it is not set yet. */
if (*ifname)
return *ifname;
return 0;
if (format_ifname_alloc(ifindex, ifname) < 0)
return NULL;
return *ifname;
return format_ifname_alloc(ifindex, ifname);
}