udev,network: make link_get_type_string() return negative errno on failure

And make net_match_config() propagate the error.
This commit is contained in:
Yu Watanabe
2021-05-14 09:18:29 +09:00
parent 170e88c8e3
commit 1a3caa49d7
7 changed files with 45 additions and 23 deletions
+5 -2
View File
@@ -134,7 +134,7 @@ static const char *const wifi_iftype_table[NL80211_IFTYPE_MAX+1] = {
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(wifi_iftype, enum nl80211_iftype);
bool net_match_config(
int net_match_config(
const NetMatch *match,
sd_device *device,
const struct ether_addr *mac,
@@ -149,10 +149,13 @@ bool net_match_config(
_cleanup_free_ char *iftype_str = NULL;
const char *path = NULL;
int r;
assert(match);
iftype_str = link_get_type_string(device, iftype);
r = link_get_type_string(device, iftype, &iftype_str);
if (r == -ENOMEM)
return r;
if (device) {
const char *mac_str;
+1 -1
View File
@@ -26,7 +26,7 @@ typedef struct NetMatch {
void net_match_clear(NetMatch *match);
bool net_match_is_empty(const NetMatch *match);
bool net_match_config(
int net_match_config(
const NetMatch *match,
sd_device *device,
const struct ether_addr *mac,