On Sun, Oct 16, 2016 at 12:50:58AM -0000, Shreya Shrivastava wrote:
> Add checks for negative return value to uses of event_notifier_init.
> Signed-off-by: Shreya Shrivastava <pin...@sigaint.org>
> 
> ---
>  tests/test-aio.c | 59
> ++++++++++++++++++++++++++++----------------------------
>  1 file changed, 30 insertions(+), 29 deletions(-)
> 
> diff --git a/tests/test-aio.c b/tests/test-aio.c
> index 03aa846..49b99f6 100644
> --- a/tests/test-aio.c
> +++ b/tests/test-aio.c
> @@ -137,8 +137,8 @@ static void test_acquire(void)
>      AcquireTestData data;
> 
>      /* Dummy event notifier ensures aio_poll() will block */
> -    event_notifier_init(&notifier, false);
> -    set_event_notifier(ctx, &notifier, dummy_notifier_read);
> +    if (event_notifier_init(&notifier, false))
> +        set_event_notifier(ctx, &notifier, dummy_notifier_read);

Silently ignoring the error is not useful.

You could define a helper function:

static void check_event_notifier_init(EventNotifier *notifier)
{
    int ret = event_notifier_init(notifier, false);

    g_assert(ret == 0);
}

Then use the helper instead of calling event_notifier_init() directly.
That way the test case will fail loudly if event_notifier_int() failed.

Attachment: signature.asc
Description: PGP signature

Reply via email to