[PATCH 1/2] Fix service driver selection when WHO header is informed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Drivers which support WHO header should be checked first since they have
priority e.g. pcsuite over ftp.
---
 src/service.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/service.c b/src/service.c
index 196a5c1..c6ce101 100644
--- a/src/service.c
+++ b/src/service.c
@@ -49,8 +49,8 @@ struct obex_service_driver
*obex_service_driver_find(GSList *list,
 		struct obex_service_driver *driver = l->data;

 		if (driver->who && who &&
-				driver->who_size == who_size &&
-				memcmp(driver->who, who, who_size) != 0)
+				(driver->who_size != who_size ||
+				memcmp(driver->who, who, who_size) != 0))
 			continue;

 		if (driver->target == NULL && target == NULL)
@@ -97,7 +97,11 @@ int obex_service_driver_register(struct
obex_service_driver *driver)

 	debug("driver %p service %s registered", driver, driver->name);

-	drivers = g_slist_append(drivers, driver);
+	/* Drivers that support who has priority */
+	if (driver->who)
+		drivers = g_slist_prepend(drivers, driver);
+	else
+		drivers = g_slist_append(drivers, driver);

 	return 0;
 }
-- 
1.6.3.3

-- 
Luiz Augusto von Dentz
Computer Engineer
From cce63393c40e55ddbdbc8241bddaecdb5d7306ef Mon Sep 17 00:00:00 2001
From: Luiz Augusto Von Dentz <luiz.dentz-von@xxxxxxxxx>
Date: Mon, 22 Feb 2010 17:26:26 +0200
Subject: [PATCH 1/2] Fix service driver selection when WHO header is informed

Drivers which support WHO header should be checked first since they have
priority e.g. pcsuite over ftp.
---
 src/service.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/service.c b/src/service.c
index 196a5c1..c6ce101 100644
--- a/src/service.c
+++ b/src/service.c
@@ -49,8 +49,8 @@ struct obex_service_driver *obex_service_driver_find(GSList *list,
 		struct obex_service_driver *driver = l->data;
 
 		if (driver->who && who &&
-				driver->who_size == who_size &&
-				memcmp(driver->who, who, who_size) != 0)
+				(driver->who_size != who_size ||
+				memcmp(driver->who, who, who_size) != 0))
 			continue;
 
 		if (driver->target == NULL && target == NULL)
@@ -97,7 +97,11 @@ int obex_service_driver_register(struct obex_service_driver *driver)
 
 	debug("driver %p service %s registered", driver, driver->name);
 
-	drivers = g_slist_append(drivers, driver);
+	/* Drivers that support who has priority */
+	if (driver->who)
+		drivers = g_slist_prepend(drivers, driver);
+	else
+		drivers = g_slist_append(drivers, driver);
 
 	return 0;
 }
-- 
1.6.3.3


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux