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

Paul Gildea gildeap at tcd.ie
Wed Feb 15 17:11:48 UTC 2017


Hey Aleksander,

Yep, that fixes it in the same way but clearer! Don't need to pass in *out
(or pass in 0).
Didn't check if the other bits were for anything so left them alone in my
patch.

Thanks,

--
Paul

On 15 February 2017 at 16:47, Aleksander Morgado <aleksander at aleksander.es>
wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libqmi-devel/attachments/20170215/8aa4d342/attachment.html>


More information about the libqmi-devel mailing list