linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bluez-devel] [DBUS PATCH] GetAlias crash
@ 2006-02-22 19:42 Claudio Takahasi
  2006-02-22 21:36 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Claudio Takahasi @ 2006-02-22 19:42 UTC (permalink / raw)
  To: bluez-devel

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]

Hi Marcel,

The GetAlias is crashing when the requested device alias doesn't
belongs to "aliases" file.

Now, the  daemon is returning the same error message used in the
RemoteAlias: "Error org.bluez.Error: No such device or address".
Is it ok?

The "err" casting to a positive value is a little bit uggly. If you
prefer another approach, fell free to change or let me know that I can
change. :)

Regards,
Claudio.
--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT

[-- Attachment #2: get-alias-crash.patch --]
[-- Type: text/x-patch, Size: 958 bytes --]

Index: hcid/dbus-device.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-device.c,v
retrieving revision 1.7
diff -u -r1.7 dbus-device.c
--- hcid/dbus-device.c	22 Feb 2006 17:43:28 -0000	1.7
+++ hcid/dbus-device.c	22 Feb 2006 19:29:59 -0000
@@ -182,19 +182,26 @@
 	DBusMessage *reply;
 	char str[249], *str_ptr = str, *addr_ptr;
 	bdaddr_t bdaddr;
+	int err;
 
 	dbus_message_iter_init(msg, &iter);
 	dbus_message_iter_get_basic(&iter, &addr_ptr);
 
 	str2ba(addr_ptr, &bdaddr);
 
-	get_device_alias(dbus_data->dev_id, &bdaddr, str, sizeof(str));
+	err = get_device_alias(dbus_data->dev_id, &bdaddr, str, sizeof(str));
+
+	if (err < 0) {
+		reply = bluez_new_failure_msg(msg, BLUEZ_ESYSTEM_OFFSET | -err);
+		goto failed;
+	}
 
 	reply = dbus_message_new_method_return(msg);
 
 	dbus_message_append_args(reply, DBUS_TYPE_STRING, &str_ptr,
 					DBUS_TYPE_INVALID);
 
+failed:
 	return reply;
 }
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [DBUS PATCH] GetAlias crash
  2006-02-22 19:42 [Bluez-devel] [DBUS PATCH] GetAlias crash Claudio Takahasi
@ 2006-02-22 21:36 ` Marcel Holtmann
  2006-02-22 23:45   ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2006-02-22 21:36 UTC (permalink / raw)
  To: bluez-devel

Hi Claudio,

> The GetAlias is crashing when the requested device alias doesn't
> belongs to "aliases" file.

good catch.

> Now, the  daemon is returning the same error message used in the
> RemoteAlias: "Error org.bluez.Error: No such device or address".
> Is it ok?

The GetAlias and RemoteAlias must become GetRemoteAlias. I spent some
time thinking about it and after writing the first code for it, I
actually realized that GetRemoteAlias and SetRemoteAlias methods and
RemoteAliasChanged signal would be much better and cleaner.

> The "err" casting to a positive value is a little bit uggly. If you
> prefer another approach, fell free to change or let me know that I can
> change. :)

I think we might gonna change the error code reply once again. For some
higher level programming languages they translate to exceptions and in
this case we have to define our own error codes/exceptions. However I
haven't had the time to fully think about it.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [DBUS PATCH] GetAlias crash
  2006-02-22 21:36 ` Marcel Holtmann
@ 2006-02-22 23:45   ` Marcel Holtmann
  2006-02-23 11:51     ` Claudio Takahasi
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2006-02-22 23:45 UTC (permalink / raw)
  To: bluez-devel

Hi Claudio,

> > Now, the  daemon is returning the same error message used in the
> > RemoteAlias: "Error org.bluez.Error: No such device or address".
> > Is it ok?
> 
> The GetAlias and RemoteAlias must become GetRemoteAlias. I spent some
> time thinking about it and after writing the first code for it, I
> actually realized that GetRemoteAlias and SetRemoteAlias methods and
> RemoteAliasChanged signal would be much better and cleaner.

I did all the needed changes and finally checked in a first draft
version of the D-Bus API document.

We now really need the dbus-test script working with the new API and I
think we also should write a bunch of regression tests for testing our
new API.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [DBUS PATCH] GetAlias crash
  2006-02-22 23:45   ` Marcel Holtmann
@ 2006-02-23 11:51     ` Claudio Takahasi
  2006-02-23 12:12       ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Claudio Takahasi @ 2006-02-23 11:51 UTC (permalink / raw)
  To: bluez-devel

Hi Marcel,

On 2/22/06, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Claudio,
>
> > > Now, the  daemon is returning the same error message used in the
> > > RemoteAlias: "Error org.bluez.Error: No such device or address".
> > > Is it ok?
> >
> > The GetAlias and RemoteAlias must become GetRemoteAlias. I spent some
> > time thinking about it and after writing the first code for it, I
> > actually realized that GetRemoteAlias and SetRemoteAlias methods and
> > RemoteAliasChanged signal would be much better and cleaner.
>
> I did all the needed changes and finally checked in a first draft
> version of the D-Bus API document.
>
> We now really need the dbus-test script working with the new API and I
> think we also should write a bunch of regression tests for testing our
> new API.
[Claudio Takahasi]
Eduardo is having happy moments with the dbus-test python script. Due
the big changes he had to implement the some functions from the
scratch.

I think he is going to deliver a first version soon.

Regards,
Claudio.

>
> Regards
>
> Marcel
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting langua=
ge
> that extends applications into web and mobile media. Attend the live webc=
ast
> and join the prime developer group breaking into this new coding territor=
y!
> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=
=3D121642
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [DBUS PATCH] GetAlias crash
  2006-02-23 11:51     ` Claudio Takahasi
@ 2006-02-23 12:12       ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2006-02-23 12:12 UTC (permalink / raw)
  To: bluez-devel

Hi Claudio,

> > We now really need the dbus-test script working with the new API and I
> > think we also should write a bunch of regression tests for testing our
> > new API.
> 
> Eduardo is having happy moments with the dbus-test python script. Due
> the big changes he had to implement the some functions from the
> scratch.
> 
> I think he is going to deliver a first version soon.

I am looking forward to it.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-02-23 12:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-22 19:42 [Bluez-devel] [DBUS PATCH] GetAlias crash Claudio Takahasi
2006-02-22 21:36 ` Marcel Holtmann
2006-02-22 23:45   ` Marcel Holtmann
2006-02-23 11:51     ` Claudio Takahasi
2006-02-23 12:12       ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).