summaryrefslogtreecommitdiff
path: root/attrib/gatttool.c
diff options
context:
space:
mode:
authorEder Ruiz Maria <eder.ruiz@openbossa.org>2013-04-16 11:49:54 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-04-17 11:21:29 +0300
commit3dacf2769dad2bd87fbc1bfa1a14e1069c7b4119 (patch)
tree8549a661f257d1af26d44156085df8adc6af477b /attrib/gatttool.c
parent519fe630ef9f78442ae25f719954475f591809d0 (diff)
downloadbluez-3dacf2769dad2bd87fbc1bfa1a14e1069c7b4119.tar.gz
gatttool: Use GError to propage error messages to caller
Handle runtime errors outside gatt_connect(), using GError to propagate error messages to caller.
Diffstat (limited to 'attrib/gatttool.c')
-rw-r--r--attrib/gatttool.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 1dd0c354c..e1d8407ba 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -575,7 +575,7 @@ int main(int argc, char *argv[])
if (g_option_context_parse(context, &argc, &argv, &gerr) == FALSE) {
g_printerr("%s\n", gerr->message);
- g_error_free(gerr);
+ g_clear_error(&gerr);
}
if (opt_interactive) {
@@ -610,8 +610,10 @@ int main(int argc, char *argv[])
}
chan = gatt_connect(opt_src, opt_dst, opt_dst_type, opt_sec_level,
- opt_psm, opt_mtu, connect_cb);
+ opt_psm, opt_mtu, connect_cb, &gerr);
if (chan == NULL) {
+ g_printerr("%s\n", gerr->message);
+ g_clear_error(&gerr);
got_error = TRUE;
goto done;
}