Getting repeatable connection problem after using an event loop

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Sat Oct 3 22:58:18 UTC 2020


On Sat, 3 Oct 2020 08:28:36 -0700, Jimi Damon wrote:

> /* Callback Function */
>     int32_t tcb(sd_bus_message* message, void* userdata, sd_bus_error*
> error)
>     {
> 
>         waiting_control_t* ud = userdata;
>         if (ud)
>         {
>             /* printf("CALLBACK CALLED\n"); */
>             ud->found = 1;
>             sd_bus_slot_unref(ud->slot);
>         }
> 
>         return EXIT_SUCCESS;
>     }

Just a thought, the man page
<https://www.freedesktop.org/software/systemd/man/sd_bus_add_match.html>
says “If [the callback] wants other callbacks that match the same rule
to be called, it should return 0. Otherwise it should return a positive
integer”. Here you are returning 0 (EXIT_SUCCESS). Does it make a
difference if you return a value like 1?

> The problem I have is that if I call another API function
> (logging_client_set_log_path) AFTER I have called this function, then
> the second API call (which sets a property)  ALWAYS fails with a -22
> return code (coming from sd_bus_set_property). However, if I don't
> call this wait_for_signal API call, then my other API function seems
> to always succeed.

According to this
<https://www.freedesktop.org/software/systemd/man/sd_bus_call.html>
(and also checking /usr/include/asm-generic/errno-base.h), that value is
-EINVAL, and there is a list of possible reasons for such an error. The
fourth one kind of stands out for me: “The input parameter error is
non-NULL but was not set to SD_BUS_ERROR_NULL”. Could that be
applicable?


More information about the dbus mailing list