diff options
author | Thomas Haller <thaller@redhat.com> | 2018-05-29 11:26:11 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-05-29 13:14:01 +0200 |
commit | 3c6bd6769b528202cb9c0bb7a68a537e0429f43c (patch) | |
tree | efd963683d523f969aa24dfc8b667b2d23312b08 | |
parent | daf4ba43da702e182df3c90b969c1d8fd762185b (diff) | |
download | NetworkManager-3c6bd6769b528202cb9c0bb7a68a537e0429f43c.tar.gz |
shared: fix parsing aliases for flags in _nm_utils_enum_from_str_full()
Otherwise, the last alias overwrites previous values.
Fixes: b9fa0e0a195e9cf7363b563cca7ffec4b5016afd
-rw-r--r-- | libnm-core/tests/test-general.c | 3 | ||||
-rw-r--r-- | shared/nm-utils/nm-enum-utils.c | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index a704368c8b..43750eb231 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -6531,7 +6531,8 @@ test_nm_utils_enum (void) _test_nm_utils_enum_from_str_do_full (color_flags, "nick-4d,nick-red,nick-5,green,nick-red", TRUE, - NM_TEST_GENERAL_COLOR_FLAGS_RED, + 0x4D + | NM_TEST_GENERAL_COLOR_FLAGS_GREEN, NULL, color_value_infos); diff --git a/shared/nm-utils/nm-enum-utils.c b/shared/nm-utils/nm-enum-utils.c index b9bc6e88fa..c79e96e22f 100644 --- a/shared/nm-utils/nm-enum-utils.c +++ b/shared/nm-utils/nm-enum-utils.c @@ -243,7 +243,7 @@ _nm_utils_enum_from_str_full (GType type, else { nick = _find_value_info (value_infos, s); if (nick) - uvalue = (unsigned) nick->value; + uvalue |= (unsigned) nick->value; else { ret = FALSE; break; |