linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name
@ 2012-12-19  1:16 Anderson Lizardo
  2012-12-19  1:16 ` [PATCH BlueZ 2/3] core: Remove bogus DBG() Anderson Lizardo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anderson Lizardo @ 2012-12-19  1:16 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

When BlueZ starts without a main.conf, adapter->name will be initially
NULL, until adapter_name_changed() is called and name is set to "BlueZ".

Before this, store_adapter_info() will try to access a NULL pointer.

Fixes this GLib error:

(bluetoothd:1721): GLib-CRITICAL **: g_key_file_set_string: assertion
`string != NULL' failed
---
 src/adapter.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index 9b83afe..d62b0fe 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -193,7 +193,9 @@ static void store_adapter_info(struct btd_adapter *adapter)
 
 	key_file = g_key_file_new();
 
-	g_key_file_set_string(key_file, "General", "Name", adapter->name);
+	if (adapter->name)
+		g_key_file_set_string(key_file, "General", "Name",
+								adapter->name);
 
 	g_key_file_set_boolean(key_file, "General", "Pairable",
 				adapter->pairable);
-- 
1.7.9.5


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

* [PATCH BlueZ 2/3] core: Remove bogus DBG()
  2012-12-19  1:16 [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name Anderson Lizardo
@ 2012-12-19  1:16 ` Anderson Lizardo
  2012-12-19  1:16 ` [PATCH BlueZ 3/3] core: Remove reference to old "mgmtops" name Anderson Lizardo
  2012-12-19  7:32 ` [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Anderson Lizardo @ 2012-12-19  1:16 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

mgmt_set_name() already prints the same information, and message still
refers to mgmtops.
---
 src/mgmt.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/src/mgmt.c b/src/mgmt.c
index ce1ff2f..17518cb 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -1163,8 +1163,6 @@ static void read_info_complete(int sk, uint16_t index, void *buf, size_t len)
 
 	name = btd_adapter_get_name(adapter);
 
-	DBG("mgmtops setting name %s", name);
-
 	if (name)
 		mgmt_set_name(index, name);
 	else
-- 
1.7.9.5


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

* [PATCH BlueZ 3/3] core: Remove reference to old "mgmtops" name
  2012-12-19  1:16 [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name Anderson Lizardo
  2012-12-19  1:16 ` [PATCH BlueZ 2/3] core: Remove bogus DBG() Anderson Lizardo
@ 2012-12-19  1:16 ` Anderson Lizardo
  2012-12-19  7:32 ` [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Anderson Lizardo @ 2012-12-19  1:16 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

---
 src/mgmt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mgmt.c b/src/mgmt.c
index 17518cb..f10bd15 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -1155,7 +1155,7 @@ static void read_info_complete(int sk, uint16_t index, void *buf, size_t len)
 	adapter = btd_manager_register_adapter(index,
 					mgmt_powered(info->current_settings));
 	if (adapter == NULL) {
-		error("mgmtops: unable to register adapter");
+		error("mgmt: unable to register adapter");
 		return;
 	}
 
-- 
1.7.9.5


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

* Re: [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name
  2012-12-19  1:16 [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name Anderson Lizardo
  2012-12-19  1:16 ` [PATCH BlueZ 2/3] core: Remove bogus DBG() Anderson Lizardo
  2012-12-19  1:16 ` [PATCH BlueZ 3/3] core: Remove reference to old "mgmtops" name Anderson Lizardo
@ 2012-12-19  7:32 ` Johan Hedberg
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2012-12-19  7:32 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth

Hi Lizardo,

On Tue, Dec 18, 2012, Anderson Lizardo wrote:
> When BlueZ starts without a main.conf, adapter->name will be initially
> NULL, until adapter_name_changed() is called and name is set to "BlueZ".
> 
> Before this, store_adapter_info() will try to access a NULL pointer.
> 
> Fixes this GLib error:
> 
> (bluetoothd:1721): GLib-CRITICAL **: g_key_file_set_string: assertion
> `string != NULL' failed
> ---
>  src/adapter.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

All three patches have been applied. Thanks.

Johan

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

end of thread, other threads:[~2012-12-19  7:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-19  1:16 [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name Anderson Lizardo
2012-12-19  1:16 ` [PATCH BlueZ 2/3] core: Remove bogus DBG() Anderson Lizardo
2012-12-19  1:16 ` [PATCH BlueZ 3/3] core: Remove reference to old "mgmtops" name Anderson Lizardo
2012-12-19  7:32 ` [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name Johan Hedberg

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).