diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-09-28 15:04:52 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-09-28 20:37:09 +0200 |
commit | 5977b71f28075c34eb9e45aaa2d7cdc791f7eaf8 (patch) | |
tree | 44f0e8caf628eae20a9be91e63b7f6b47d871551 /src/libsystemd-network/network-common.c | |
parent | tree-wide: make format_ifname() or friends return negative errno on failure (diff) | |
download | systemd-5977b71f28075c34eb9e45aaa2d7cdc791f7eaf8.tar.xz systemd-5977b71f28075c34eb9e45aaa2d7cdc791f7eaf8.zip |
libsystemd-network: make sd_dhcp_client_get_ifname() or friends return negative errno on error
Diffstat (limited to 'src/libsystemd-network/network-common.c')
-rw-r--r-- | src/libsystemd-network/network-common.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libsystemd-network/network-common.c b/src/libsystemd-network/network-common.c index c8f3305b19..b8b4ecdaae 100644 --- a/src/libsystemd-network/network-common.c +++ b/src/libsystemd-network/network-common.c @@ -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); } |