summaryrefslogtreecommitdiff
path: root/tools/hciconfig.c
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2011-11-16 09:19:55 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2011-11-17 13:57:53 +0200
commit382c867b0946d1295413bc4f3c783f97e581462b (patch)
treea0510f3bb0bdd360b6f7fe33e68e21eac5c74ed3 /tools/hciconfig.c
parent100527bd5a2482bba4749a939a046f2371a9c531 (diff)
downloadbluez-382c867b0946d1295413bc4f3c783f97e581462b.tar.gz
hciconfig: 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/hciconfig.c')
-rw-r--r--tools/hciconfig.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index cbd0d0ee9..35b80b195 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -210,9 +210,9 @@ static void cmd_le_addr(int ctl, int hdev, char *opt)
dd = hci_open_dev(hdev);
if (dd < 0) {
- err = errno;
+ err = -errno;
fprintf(stderr, "Could not open device: %s(%d)\n",
- strerror(err), err);
+ strerror(-err), -err);
exit(1);
}
@@ -230,9 +230,9 @@ static void cmd_le_addr(int ctl, int hdev, char *opt)
ret = hci_send_req(dd, &rq, 1000);
if (status || ret < 0) {
- err = errno;
+ err = -errno;
fprintf(stderr, "Can't set random address for hci%d: "
- "%s (%d)\n", hdev, strerror(err), err);
+ "%s (%d)\n", hdev, strerror(-err), -err);
}
hci_close_dev(dd);