summaryrefslogtreecommitdiff
path: root/src/log.c
diff options
context:
space:
mode:
authorGustavo F. Padovan <gustavo@padovan.org>2010-06-08 04:11:49 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2010-06-08 15:57:44 +0800
commit684beb7c3f4f1f20caef156a7a10ae5e490b6dfa (patch)
tree6ea5ca12d8c9db3753893600aa238715c76cfa7b /src/log.c
parent7015919115b8fb972a453b579d9a06f3012355de (diff)
downloadbluez-684beb7c3f4f1f20caef156a7a10ae5e490b6dfa.tar.gz
Fix regression with debug via SIGUSR2
The new dynamic debug feature was not using the SIGUSR2 signal so this was causing bluetoothd to crash when one tries to toggle debug via SIGUSR2. This patch brings back such compatibility andadds debug_string and debug_enabled vars.
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/log.c b/src/log.c
index cb02aadcf..1bc0a422c 100644
--- a/src/log.c
+++ b/src/log.c
@@ -71,6 +71,8 @@ extern struct btd_debug_desc __stop___debug[];
static gchar **enabled = NULL;
+int debug_enabled = FALSE;
+
static gboolean is_enabled(struct btd_debug_desc *desc)
{
int i;
@@ -90,14 +92,25 @@ static gboolean is_enabled(struct btd_debug_desc *desc)
return 0;
}
+void __btd_toggle_debug()
+{
+ debug_enabled = !debug_enabled;
+}
+
void __btd_log_init(const char *debug, int detach)
{
int option = LOG_NDELAY | LOG_PID;
struct btd_debug_desc *desc;
const char *name = NULL, *file = NULL;
- if (debug != NULL)
- enabled = g_strsplit_set(debug, ":, ", 0);
+ if (debug != NULL) {
+ debug_enabled = TRUE;
+ } else {
+ debug = g_strdup("*");
+ debug_enabled = FALSE;
+ }
+
+ enabled = g_strsplit_set(debug, ":, ", 0);
for (desc = __start___debug; desc < __stop___debug; desc++) {
if (file != NULL || name != NULL) {