Re: Printing errors returned from dbus_error_is_set()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Burt,

On 13:38 Fri 26 Aug, Burt Silverman wrote:
> Here is a patch for connect_dbus() in src/main.c that follows the
> usage suggested by the dbus package. This was very important for me
> when I accidentally moved a configuration file
> /etc/bluetooth/main.conf. Most other places in bluetooth handle the
> error correctly.
> 
> From dbus/dbus/dbus-errors.c:
>  * In essence D-Bus error reporting works as follows:
>  *
>  * @code
>  * DBusError error;
>  * dbus_error_init (&error);
>  * dbus_some_function (arg1, arg2, &error);
>  * if (dbus_error_is_set (&error))
>  *   {
>  *     fprintf (stderr, "an error occurred: %s\n", error.message);
>  *     dbus_error_free (&error);
>  *   }
>  * @endcode
> 
> Here's the patch:
> diff --git a/src/main.c b/src/main.c
> index 7fecc5a..db78da8 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -311,6 +311,7 @@ static int connect_dbus(void)
>         conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, BLUEZ_NAME, &err);
>         if (!conn) {
>                 if (dbus_error_is_set(&err)) {
> +                       fprintf(stderr, "an error occurred: %s\n", err.message);

The patch looks good, you just may want to use g_printerr() instead.

>                         dbus_error_free(&err);
>                         return -EIO;
>                 }
> 
> Is this the correct place to send the patch?

Yes, this is the correct place. Just send a properly formatted patch,
the easiest way is using git format-patch and git send-email.

> 
> Thank you,
> Burt Silverman
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Cheers,
-- 
Vinicius
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux