[PATCH 1/1] Check error before call dbus_message_get_args to acquire arguments.

Marcel Holtmann marcel at holtmann.org
Mon Apr 26 23:10:28 PDT 2010


Hi Martin,

> > you email still gets attached to a previous thread from you. It should
> > show up as a new one. This is weird,
> > 
> > > Function dbus_message_get_args just checks the signature which may
> > > happens to be s(string), then it will just return TRUE, and the error
> > > message is treated as return value.
> > > So dbus_set_error_from_message is used to check the error, before
> > > call dbus_message_get_args.
> > > ---
> > >  plugins/bluetooth.c |   35 ++++++++++++++++++++++++++++++++++-
> > >  1 files changed, 34 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
> > > index 1c0fa96..4c5fd6d 100644
> > > --- a/plugins/bluetooth.c
> > > +++ b/plugins/bluetooth.c
> > > @@ -89,6 +89,13 @@ static void connect_reply(DBusPendingCall *call, void
> > *user_data)
> > >
> > >  	dbus_error_init(&error);
> > >
> > > +	if (dbus_set_error_from_message(&error, reply) == TRUE) {
> > > +		connman_error("%s", error.message);
> > > +		dbus_error_free(&error);
> > > +
> > > +		goto done;
> > > +	}
> > > +
> > 
> > I hate to be picky, but the goto done should not be proceeded by an
> Again, picky is the good character for developer. ;-)
> However, I am a little confused here, Do we have a standard that when empty line is needed, and when is not needed?

if it is in the if block and that if block is the error case, then we
don't have the extra empty. If it is outside the if block and in the
code flow, then we do. Just look on how we do return etc.

Regards

Marcel





More information about the connman mailing list