GetAlias crash
PATCH 1/1 GetAlias crash
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
Index: hcid/dbus-device.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-device.c,v retrieving revision 1.7
dbus-device.c +8 -1
@@ -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; }
Marcel Holtmann
maintainerHi Claudio,
Quoted 2 lines
The GetAlias is crashing when the requested device alias doesn't belongs to "aliases" file.
good catch.
Quoted 3 lines
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.
Quoted 3 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Claudio,
Quoted 8 lines
Quoted 3 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Marcel,
Quoted 11 lines · Marcel Holtmann
Hi Claudio,
Quoted 8 lines
Quoted 3 lines
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.
Quoted 6 lines
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.
Quoted 10 lines
Regards
Marcel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting langua=
ge
Quoted 1 line
that extends applications into web and mobile media. Attend the live webc=
ast
Quoted 1 line
and join the prime developer group breaking into this new coding territor=
y!
=3D121642
Quoted 5 lines
_______________________________________________
Bluez-devel mailing list
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Claudio,
Quoted 9 lines
Quoted 3 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel