summaryrefslogtreecommitdiff
path: root/tools/hcitool.c
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2011-11-16 09:19:54 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2011-11-17 13:57:53 +0200
commit100527bd5a2482bba4749a939a046f2371a9c531 (patch)
tree7b13eebeaab858bb062c3f94b60e933907ff919e /tools/hcitool.c
parent7f7d66842b9ee4c6a5c2965eccbc20c5d4d6b4fc (diff)
downloadbluez-100527bd5a2482bba4749a939a046f2371a9c531.tar.gz
hcitool: Fix errno handling convention
Variables which are assigned to the errno variable (usually called "err") should be negative, and "-err" should be used where a positive value is needed.
Diffstat (limited to 'tools/hcitool.c')
-rw-r--r--tools/hcitool.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 5c4a0bc31..5189d8d1c 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2696,9 +2696,9 @@ static void cmd_lewladd(int dev_id, int argc, char **argv)
hci_close_dev(dd);
if (err < 0) {
- err = errno;
+ err = -errno;
fprintf(stderr, "Can't add to white list: %s(%d)\n",
- strerror(err), err);
+ strerror(-err), -err);
exit(1);
}
}
@@ -2786,9 +2786,9 @@ static void cmd_lewlsz(int dev_id, int argc, char **argv)
hci_close_dev(dd);
if (err < 0) {
- err = errno;
+ err = -errno;
fprintf(stderr, "Can't read white list size: %s(%d)\n",
- strerror(err), err);
+ strerror(-err), -err);
exit(1);
}
@@ -2831,9 +2831,9 @@ static void cmd_lewlclr(int dev_id, int argc, char **argv)
hci_close_dev(dd);
if (err < 0) {
- err = errno;
+ err = -errno;
fprintf(stderr, "Can't clear white list: %s(%d)\n",
- strerror(err), err);
+ strerror(-err), -err);
exit(1);
}
}
@@ -2961,9 +2961,9 @@ static void cmd_lecup(int dev_id, int argc, char **argv)
if (hci_le_conn_update(dd, htobs(handle), htobs(min), htobs(max),
htobs(latency), htobs(timeout), 5000) < 0) {
- int err = errno;
+ int err = -errno;
fprintf(stderr, "Could not change connection params: %s(%d)\n",
- strerror(err), err);
+ strerror(-err), -err);
}
hci_close_dev(dd);