summaryrefslogtreecommitdiff
path: root/extra/bluez/bluez-5.50-signal-signature-btpclient.patch
blob: 3c2dc9350036924c9f0293fde71083f06b8bb712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
diff -rauN bluez-5.50/tools/btpclient.c bluez-5.50-signal-signature-btpclient-patch/tools/btpclient.c
--- bluez-5.50/tools/btpclient.c	2018-03-10 16:37:07.000000000 +0100
+++ bluez-5.50-signal-signature-btpclient-patch/tools/btpclient.c	2019-07-31 19:36:58.022464813 +0200
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <getopt.h>
+#include <signal.h>
 
 #include <ell/ell.h>
 
@@ -2827,8 +2828,7 @@
 					btp_core_unregister, NULL, NULL);
 }
 
-static void signal_handler(struct l_signal *signal, uint32_t signo,
-							void *user_data)
+static void signal_handler(uint32_t signo, void *user_data)
 {
 	switch (signo) {
 	case SIGINT:
@@ -3156,8 +3156,6 @@
 int main(int argc, char *argv[])
 {
 	struct l_dbus_client *client;
-	struct l_signal *signal;
-	sigset_t mask;
 	int opt;
 
 	l_log_set_stderr();
@@ -3194,11 +3192,6 @@
 
 	adapters = l_queue_new();
 
-	sigemptyset(&mask);
-	sigaddset(&mask, SIGINT);
-	sigaddset(&mask, SIGTERM);
-	signal = l_signal_create(&mask, signal_handler, NULL, NULL);
-
 	dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS);
 	l_dbus_set_ready_handler(dbus, ready_callback, NULL, NULL);
 	client = l_dbus_client_new(dbus, "org.bluez", "/org/bluez");
@@ -3212,11 +3205,10 @@
 
 	l_dbus_client_set_ready_handler(client, client_ready, NULL, NULL);
 
-	l_main_run();
+	l_main_run_with_signal(signal_handler, NULL);
 
 	l_dbus_client_destroy(client);
 	l_dbus_destroy(dbus);
-	l_signal_remove(signal);
 	btp_cleanup(btp);
 
 	l_queue_destroy(adapters, (l_queue_destroy_func_t)btp_adapter_free);