mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-15 05:40:31 +01:00
core: use _nm_utils_ascii_str_to_bool() to parse boolean udev properties
Previously, we used nm_udev_utils_property_as_boolean(), which was taken from g_udev_device_get_property_as_boolean(). That function accepts "1" and "true" (with ASCII case insensitive). When we parse a flag, there is no need to reject "no", "yes" or "on"/"off" as invalid (and thus return FALSE). We have a boolean parse method _nm_utils_ascii_str_to_bool(), which parses everything that nm_udev_utils_property_as_boolean() accepts, and more. Be liberal in what we accept, so use our general parse function.
This commit is contained in:
parent
3762e8f0c5
commit
48a3cebce5
2 changed files with 2 additions and 2 deletions
|
|
@ -1747,7 +1747,7 @@ new_default_connection(NMDevice *self)
|
|||
if (dev)
|
||||
uprop = udev_device_get_property_value(dev, "NM_AUTO_DEFAULT_LINK_LOCAL_ONLY");
|
||||
|
||||
if (nm_udev_utils_property_as_boolean(uprop)) {
|
||||
if (_nm_utils_ascii_str_to_bool(uprop, FALSE)) {
|
||||
setting = nm_setting_ip4_config_new();
|
||||
g_object_set(setting,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
|
|
|
|||
|
|
@ -1477,7 +1477,7 @@ nm_platform_link_get_unmanaged(NMPlatform *self, int ifindex, gboolean *unmanage
|
|||
const char *value;
|
||||
|
||||
if (nm_platform_link_get_udev_property(self, ifindex, "NM_UNMANAGED", &value)) {
|
||||
NM_SET_OUT(unmanaged, nm_udev_utils_property_as_boolean(value));
|
||||
NM_SET_OUT(unmanaged, _nm_utils_ascii_str_to_bool(value, FALSE));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue