summaryrefslogtreecommitdiff
path: root/obexd
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2016-06-30 17:01:28 -0400
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-07-04 14:33:16 +0300
commit6c75f43e50d754b4605498a8a68d2be4bc19ee37 (patch)
tree80263f83437f49f33461d7dcee5ca2a38066b853 /obexd
parent16102009366f25a7ba3531c235d65461b5012372 (diff)
downloadbluez-6c75f43e50d754b4605498a8a68d2be4bc19ee37.tar.gz
obexd: Return dummy_data instead of int in phonebook-dummy
There are two functions in phonebook-dummy that were returning 'int's instead of 'struct dummy_data' phonebook_create_cache phonebook_get_entry As a result, when an obex-client sends the GetSize command, the obexd on the server segfaults. Fix this by storing the id and returning the dummy_data struct. The GetSize test now passes correctly.
Diffstat (limited to 'obexd')
-rw-r--r--obexd/plugins/phonebook-dummy.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/obexd/plugins/phonebook-dummy.c b/obexd/plugins/phonebook-dummy.c
index eeb078f23..29ae8893c 100644
--- a/obexd/plugins/phonebook-dummy.c
+++ b/obexd/plugins/phonebook-dummy.c
@@ -520,7 +520,6 @@ void *phonebook_get_entry(const char *folder, const char *id,
struct dummy_data *dummy;
char *filename;
int fd;
- guint ret;
filename = g_build_filename(root_folder, folder, id, NULL);
@@ -538,13 +537,13 @@ void *phonebook_get_entry(const char *folder, const char *id,
dummy->apparams = params;
dummy->fd = fd;
- ret = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, read_entry, dummy,
+ dummy->id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, read_entry, dummy,
dummy_free);
if (err)
*err = 0;
- return GINT_TO_POINTER(ret);
+ return dummy;
}
void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
@@ -553,7 +552,7 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
struct cache_query *query;
char *foldername;
DIR *dp;
- guint ret;
+ struct dummy_data *dummy;
foldername = g_build_filename(root_folder, name, NULL);
dp = opendir(foldername);
@@ -572,11 +571,13 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
query->user_data = user_data;
query->dp = dp;
- ret = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, create_cache, query,
- query_free);
+ dummy = g_new0(struct dummy_data, 1);
+
+ dummy->id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, create_cache,
+ query, query_free);
if (err)
*err = 0;
- return GINT_TO_POINTER(ret);
+ return dummy;
}