summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp-client.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-09-28 22:04:52 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-09-29 03:37:09 +0900
commit5977b71f28075c34eb9e45aaa2d7cdc791f7eaf8 (patch)
tree44f0e8caf628eae20a9be91e63b7f6b47d871551 /src/libsystemd-network/sd-dhcp-client.c
parent01afd0f7f53f7807294ce7c008ecf8a043a920fe (diff)
downloadsystemd-5977b71f28075c34eb9e45aaa2d7cdc791f7eaf8.tar.gz
libsystemd-network: make sd_dhcp_client_get_ifname() or friends return negative errno on error
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-client.c')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 72dbd95145..45c2351c53 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -297,11 +297,19 @@ int sd_dhcp_client_set_ifname(sd_dhcp_client *client, const char *ifname) {
return free_and_strdup(&client->ifname, ifname);
}
-const char *sd_dhcp_client_get_ifname(sd_dhcp_client *client) {
- if (!client)
- return NULL;
+int sd_dhcp_client_get_ifname(sd_dhcp_client *client, const char **ret) {
+ int r;
- return get_ifname(client->ifindex, &client->ifname);
+ assert_return(client, -EINVAL);
+
+ r = get_ifname(client->ifindex, &client->ifname);
+ if (r < 0)
+ return r;
+
+ if (ret)
+ *ret = client->ifname;
+
+ return 0;
}
int sd_dhcp_client_set_mac(