[systemd-devel] [PATCH] journal-remote: check return code of sd_event_default

Tom Gundersen teg at jklm.no
Thu Sep 18 09:33:58 PDT 2014


Applied. Thanks!

Tom

On Thu, Sep 18, 2014 at 5:52 PM, Andreas Henriksson <andreas at fatal.se> wrote:
> Handle sd_event_default returning error and bail out properly
> as done in every other caller of this function.
>
> Found by coverity. Fixes: CID#1238957
> ---
>  src/journal-remote/journal-remote.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
> index 12de820..f06c2cb 100644
> --- a/src/journal-remote/journal-remote.c
> +++ b/src/journal-remote/journal-remote.c
> @@ -808,7 +808,11 @@ static int remoteserver_init(RemoteServer *s,
>                  return -EINVAL;
>          }
>
> -        sd_event_default(&s->events);
> +        r = sd_event_default(&s->events);
> +        if (r < 0) {
> +                log_error("Failed to allocate event loop: %s", strerror(-r));
> +                return r;
> +        }
>
>          setup_signals(s);
>
> --
> 2.1.0
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list