[systemd-devel] [PATCH] bus-util: return errors when encountered

Thomas H.P. Andersen phomes at gmail.com
Tue Dec 17 12:04:33 PST 2013


On Fri, Dec 13, 2013 at 9:34 PM, Thomas H.P. Andersen <phomes at gmail.com> wrote:
> From: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
>
> Introduced in:
> 9f6eb1cd58f2ddf2eb6ba0e4de056e13d938af75
> 313333b403439360c0396a50d77d0a1ee2bca4df
> ---
>  src/libsystemd-bus/bus-util.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/libsystemd-bus/bus-util.c b/src/libsystemd-bus/bus-util.c
> index 30ee67e..ae9f229 100644
> --- a/src/libsystemd-bus/bus-util.c
> +++ b/src/libsystemd-bus/bus-util.c
> @@ -212,8 +212,12 @@ int bus_verify_polkit(
>                  }
>
>                  r = sd_bus_message_enter_container(reply, 'r', "bba{ss}");
> -                if (r >= 0)
> -                        r = sd_bus_message_read(reply, "bb", &authorized, &challenge);
> +                if (r < 0)
> +                        return r;
> +
> +                r = sd_bus_message_read(reply, "bb", &authorized, &challenge);
> +                if (r < 0)
> +                        return r;
>
>                  if (authorized)
>                          return 1;
> @@ -997,6 +1001,8 @@ int bus_map_all_properties(sd_bus *bus,
>                                  r = prop->set(bus, member, m, &error, v);
>                          else
>                                  r = map_basic(bus, member, m, &error, v);
> +                        if (r < 0)
> +                                return r;
>
>                          r = sd_bus_message_exit_container(m);
>                          if (r < 0)
> --
> 1.8.4.2
>

Hi,

I'm hoping for a review of this one. I think the fixes are fairly
trivial and the reason I am asking for a review is only because of the
explicit check for 'if (r >= 0)'. It was introduced when the call to
sd_bus_message_enter_container was added in
313333b403439360c0396a50d77d0a1ee2bca4df. I don't see a reason why we
would not check for errors in r, but I thought I would ask instead of
just changing it.

- Thomas


More information about the systemd-devel mailing list