[systemd-devel] [PATCH] shared: fix wrong assertion in barrier_set_role()

David Herrmann dh.herrmann at gmail.com
Tue Feb 24 09:31:35 PST 2015


Hi

On Fri, Feb 20, 2015 at 7:14 PM, Cristian Rodríguez
<crrodriguez at opensuse.org> wrote:
>  assert(b->pipe[0] >= 0 && b->pipe[0] >= 0);
>
> Test the same condition twice, pretty sure we mean
>
>  assert(b->pipe[0] >= 0 && b->pipe[1] >= 0);

The assertion isn't particularly 'wrong', but redundant, that's true ;) Applied!

Thanks
David

> ---
>  src/shared/barrier.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/shared/barrier.c b/src/shared/barrier.c
> index f65363a..b7dca75 100644
> --- a/src/shared/barrier.c
> +++ b/src/shared/barrier.c
> @@ -178,7 +178,7 @@ void barrier_set_role(Barrier *b, unsigned int role) {
>          assert(b);
>          assert(role == BARRIER_PARENT || role == BARRIER_CHILD);
>          /* make sure this is only called once */
> -        assert(b->pipe[1] >= 0 && b->pipe[1] >= 0);
> +        assert(b->pipe[0] >= 0 && b->pipe[1] >= 0);
>
>          if (role == BARRIER_PARENT)
>                  b->pipe[1] = safe_close(b->pipe[1]);
> --
> 2.3.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