public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix crash when HDP first reliable channel is nil
@ 2012-03-16 22:53 Elvis Pfützenreuter
  2012-03-27 11:36 ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Elvis Pfützenreuter @ 2012-03-16 22:53 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: epx

Congruent to health_channel_destroy(), the "/" path is returned by MainChannel
property of HealthDevice when the first reliable channel is nil.

An empty path provokes the following error:

process xxxs: arguments to dbus_message_iter_append_basic() were incorrect,
assertion "_dbus_check_is_valid_path (*string_p)" failed in file
../../dbus/dbus-message.c line 2539.  This is normally a bug in some
application using the D-Bus library.
---
 health/hdp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/health/hdp.c b/health/hdp.c
index 812352f..eba438a 100644
--- a/health/hdp.c
+++ b/health/hdp.c
@@ -2077,7 +2077,7 @@ static DBusMessage *device_get_properties(DBusConnection *conn,
 	if (device->fr != NULL)
 		path = g_strdup(device->fr->path);
 	else
-		path = g_strdup("");
+		path = g_strdup("/");
 	dict_append_entry(&dict, "MainChannel", DBUS_TYPE_OBJECT_PATH, &path);
 	g_free(path);
 	dbus_message_iter_close_container(&iter, &dict);
-- 
1.7.5.4


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

* Re: [PATCH] Fix crash when HDP first reliable channel is nil
  2012-03-16 22:53 [PATCH] Fix crash when HDP first reliable channel is nil Elvis Pfützenreuter
@ 2012-03-27 11:36 ` Johan Hedberg
  2012-03-27 11:59   ` Elvis Pfutzenreuter
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2012-03-27 11:36 UTC (permalink / raw)
  To: Elvis Pfützenreuter; +Cc: linux-bluetooth

Hi Elvis,

On Fri, Mar 16, 2012, Elvis Pfützenreuter wrote:
> Congruent to health_channel_destroy(), the "/" path is returned by MainChannel
> property of HealthDevice when the first reliable channel is nil.
> 
> An empty path provokes the following error:
> 
> process xxxs: arguments to dbus_message_iter_append_basic() were incorrect,
> assertion "_dbus_check_is_valid_path (*string_p)" failed in file
> ../../dbus/dbus-message.c line 2539.  This is normally a bug in some
> application using the D-Bus library.
> ---
>  health/hdp.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/health/hdp.c b/health/hdp.c
> index 812352f..eba438a 100644
> --- a/health/hdp.c
> +++ b/health/hdp.c
> @@ -2077,7 +2077,7 @@ static DBusMessage *device_get_properties(DBusConnection *conn,
>  	if (device->fr != NULL)
>  		path = g_strdup(device->fr->path);
>  	else
> -		path = g_strdup("");
> +		path = g_strdup("/");
>  	dict_append_entry(&dict, "MainChannel", DBUS_TYPE_OBJECT_PATH, &path);
>  	g_free(path);
>  	dbus_message_iter_close_container(&iter, &dict);

Would it maybe make more sense to simply not include this property in
the property list if device->fr is NULL? (after all, there's nothing
interesting to be found at "/" from a HDP perspective)

Johan

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

* Re: [PATCH] Fix crash when HDP first reliable channel is nil
  2012-03-27 11:36 ` Johan Hedberg
@ 2012-03-27 11:59   ` Elvis Pfutzenreuter
  2012-03-27 12:18     ` Johan Hedberg
  0 siblings, 1 reply; 4+ messages in thread
From: Elvis Pfutzenreuter @ 2012-03-27 11:59 UTC (permalink / raw)
  To: Johan Hedberg, sancane; +Cc: linux-bluetooth

On Mar 27, 2012, at 8:36 AM, Johan Hedberg wrote:

> Hi Elvis,
> 
> On Fri, Mar 16, 2012, Elvis Pfützenreuter wrote:
>> Congruent to health_channel_destroy(), the "/" path is returned by MainChannel
>> property of HealthDevice when the first reliable channel is nil.
>> 
>> An empty path provokes the following error:
>> 
>> process xxxs: arguments to dbus_message_iter_append_basic() were incorrect,
>> assertion "_dbus_check_is_valid_path (*string_p)" failed in file
>> ../../dbus/dbus-message.c line 2539.  This is normally a bug in some
>> application using the D-Bus library.
>> ---
>> health/hdp.c |    2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/health/hdp.c b/health/hdp.c
>> index 812352f..eba438a 100644
>> --- a/health/hdp.c
>> +++ b/health/hdp.c
>> @@ -2077,7 +2077,7 @@ static DBusMessage *device_get_properties(DBusConnection *conn,
>> 	if (device->fr != NULL)
>> 		path = g_strdup(device->fr->path);
>> 	else
>> -		path = g_strdup("");
>> +		path = g_strdup("/");
>> 	dict_append_entry(&dict, "MainChannel", DBUS_TYPE_OBJECT_PATH, &path);
>> 	g_free(path);
>> 	dbus_message_iter_close_container(&iter, &dict);
> 
> Would it maybe make more sense to simply not include this property in
> the property list if device->fr is NULL? (after all, there's nothing
> interesting to be found at "/" from a HDP perspective)
> 

Could be, but when fr is deleted, a PropertyChanged signal is emitted for
MainChannel. Is there some way to signal that a property has been removed?

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

* Re: [PATCH] Fix crash when HDP first reliable channel is nil
  2012-03-27 11:59   ` Elvis Pfutzenreuter
@ 2012-03-27 12:18     ` Johan Hedberg
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2012-03-27 12:18 UTC (permalink / raw)
  To: Elvis Pfutzenreuter; +Cc: sancane, linux-bluetooth

Hi Elvis,

On Tue, Mar 27, 2012, Elvis Pfutzenreuter wrote:
> On Mar 27, 2012, at 8:36 AM, Johan Hedberg wrote:
> 
> > Hi Elvis,
> > 
> > On Fri, Mar 16, 2012, Elvis Pfützenreuter wrote:
> >> Congruent to health_channel_destroy(), the "/" path is returned by MainChannel
> >> property of HealthDevice when the first reliable channel is nil.
> >> 
> >> An empty path provokes the following error:
> >> 
> >> process xxxs: arguments to dbus_message_iter_append_basic() were incorrect,
> >> assertion "_dbus_check_is_valid_path (*string_p)" failed in file
> >> ../../dbus/dbus-message.c line 2539.  This is normally a bug in some
> >> application using the D-Bus library.
> >> ---
> >> health/hdp.c |    2 +-
> >> 1 files changed, 1 insertions(+), 1 deletions(-)
> >> 
> >> diff --git a/health/hdp.c b/health/hdp.c
> >> index 812352f..eba438a 100644
> >> --- a/health/hdp.c
> >> +++ b/health/hdp.c
> >> @@ -2077,7 +2077,7 @@ static DBusMessage *device_get_properties(DBusConnection *conn,
> >> 	if (device->fr != NULL)
> >> 		path = g_strdup(device->fr->path);
> >> 	else
> >> -		path = g_strdup("");
> >> +		path = g_strdup("/");
> >> 	dict_append_entry(&dict, "MainChannel", DBUS_TYPE_OBJECT_PATH, &path);
> >> 	g_free(path);
> >> 	dbus_message_iter_close_container(&iter, &dict);
> > 
> > Would it maybe make more sense to simply not include this property in
> > the property list if device->fr is NULL? (after all, there's nothing
> > interesting to be found at "/" from a HDP perspective)
> > 
> 
> Could be, but when fr is deleted, a PropertyChanged signal is emitted for
> MainChannel. Is there some way to signal that a property has been removed?

Instead of sending a PropertyChanged wouldn't the ChannelDeleted signal
be good enough? (the client then just needs to compare it with the
currently known MainChannel value.

Johan

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

end of thread, other threads:[~2012-03-27 12:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16 22:53 [PATCH] Fix crash when HDP first reliable channel is nil Elvis Pfützenreuter
2012-03-27 11:36 ` Johan Hedberg
2012-03-27 11:59   ` Elvis Pfutzenreuter
2012-03-27 12:18     ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox