[PATCH] qmicli, helpers: make sure flags are reset before parsing the string

Aleksander Morgado aleksander at aleksander.es
Wed Feb 15 16:47:27 UTC 2017


We OR each flag value found in the output directly, so make sure that
output is clear before adding any new flag.

Reported-by: Paul Gildea <gildeap at tcd.ie>
---

Hey Paul,

Could you try this patch and see if you still have issues?

Also fixed the same issue in the device open flags, btw.

---
 src/qmicli/qmicli-helpers.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/qmicli/qmicli-helpers.c b/src/qmicli/qmicli-helpers.c
index 2a2dad2..46e17db 100644
--- a/src/qmicli/qmicli-helpers.c
+++ b/src/qmicli/qmicli-helpers.c
@@ -237,6 +237,8 @@ qmicli_read_rat_mode_pref_from_string (const gchar *str,
     type = qmi_nas_rat_mode_preference_get_type ();
     flags_class = G_FLAGS_CLASS (g_type_class_ref (type));

+    *out = 0;
+
     items = g_strsplit_set (str, "|", 0);
     for (iter = items; iter && *iter && success; iter++) {
         if (!*iter[0])
@@ -451,6 +453,8 @@ qmicli_read_net_open_flags_from_string (const gchar *str,
     type = qmi_device_open_flags_get_type ();
     flags_class = G_FLAGS_CLASS (g_type_class_ref (type));

+    *out = 0;
+
     items = g_strsplit_set (str, "|", 0);
     for (iter = items; iter && *iter && success; iter++) {
         if (!*iter[0])
--
2.11.1


More information about the libqmi-devel mailing list