ethtool-util: make wol_options_to_string() not return all flag strings

This commit is contained in:
Yu Watanabe
2021-10-06 21:33:06 +09:00
parent 1d3d81cf01
commit b4b2a49287
2 changed files with 8 additions and 3 deletions
+6 -1
View File
@@ -43,6 +43,11 @@ int wol_options_to_string_alloc(uint32_t opts, char **ret) {
assert(ret);
if (opts == UINT32_MAX) {
*ret = NULL;
return 0;
}
for (size_t i = 0; i < ELEMENTSOF(wol_option_map); i++)
if (opts & wol_option_map[i].opt &&
!strextend_with_separator(&str, ",", wol_option_map[i].name))
@@ -55,7 +60,7 @@ int wol_options_to_string_alloc(uint32_t opts, char **ret) {
}
*ret = TAKE_PTR(str);
return 0;
return 1;
}
static const char* const port_table[] = {
+2 -2
View File
@@ -334,8 +334,8 @@ static int link_config_apply_ethtool_settings(int *ethtool_fd, const LinkConfig
_cleanup_free_ char *str = NULL;
(void) wol_options_to_string_alloc(config->wol, &str);
log_device_warning_errno(device, r, "Could not set WakeOnLan to %s, ignoring: %m",
strna(str));
log_device_warning_errno(device, r, "Could not set WakeOnLan%s%s, ignoring: %m",
isempty(str) ? "" : " to ", strempty(str));
}
r = ethtool_set_features(ethtool_fd, name, config->features);