Handle 0 cb unregister as NOENT error
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 28 Oct 2022 01:36:05 +0000 (21:36 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 28 Oct 2022 01:36:05 +0000 (21:36 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/side.c

index 14788d79d83ef855b77c4e268989a6802bf8b8c1..5c2dac4f89792480addf38ad32930cac75233e86 100644 (file)
@@ -179,17 +179,13 @@ int _side_tracer_callback_unregister(struct side_event_description *desc,
        if (!call)
                return SIDE_ERROR_INVAL;
        pthread_mutex_lock(&side_lock);
-       old_nr_cb = *desc->enabled & SIDE_EVENT_ENABLED_USER_MASK;
-       if (old_nr_cb == 0) {
-               ret = SIDE_ERROR_INVAL;
-               goto unlock;
-       }
-       old_cb = (struct side_callback *) desc->callbacks;
        cb_pos = side_tracer_callback_lookup(desc, call, priv);
        if (!cb_pos) {
                ret = SIDE_ERROR_NOENT;
                goto unlock;
        }
+       old_nr_cb = *desc->enabled & SIDE_EVENT_ENABLED_USER_MASK;
+       old_cb = (struct side_callback *) desc->callbacks;
        if (old_nr_cb == 1) {
                new_cb = (struct side_callback *) &side_empty_callback;
        } else {
This page took 0.024142 seconds and 4 git commands to generate.