summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2011-11-16 09:19:50 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2011-11-17 13:57:52 +0200
commit5c6db9e8616afb4ea93ec53bb8e3a8f00cc7ebc2 (patch)
tree19fc64a98d994ab5ef0652ebe61fbdb954a978d9 /test
parentf2c10b575c32fae045a84703762e179e47d25760 (diff)
audio/IPC: 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. This commit also changes places where errno can be replaced with -err (for consistency) and one perror() usage error.
Diffstat (limited to 'test')
-rw-r--r--test/ipctest.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/ipctest.c b/test/ipctest.c
index 9fdfac4df..496844352 100644
--- a/test/ipctest.c
+++ b/test/ipctest.c
@@ -139,7 +139,7 @@ static int service_send(struct userdata *u, const bt_audio_msg_header_t *msg)
else {
err = -errno;
ERR("Error sending data to audio service: %s(%d)",
- strerror(errno), errno);
+ strerror(-err), -err);
}
return err;
@@ -171,7 +171,7 @@ static int service_recv(struct userdata *u, bt_audio_msg_header_t *rsp)
} else {
err = -errno;
ERR("Error receiving data from audio service: %s(%d)",
- strerror(errno), errno);
+ strerror(-err), -err);
}
return err;
@@ -215,8 +215,12 @@ static int init_bt(struct userdata *u)
u->service_fd = bt_audio_service_open();
if (u->service_fd <= 0) {
- perror(strerror(errno));
- return errno;
+ int err = -errno;
+
+ ERR("bt_audio_service_open() failed: %s (%d)", strerror(-err),
+ -err);
+
+ return err;
}
return 0;