diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index e633d1a..4d85f33 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
}
/* wake up any client polling at us */
- err = write(data->pipefd[1], &c, 1);
- if (err < 0)
+ if (write(data->pipefd[1], &c, 1) < 0) {
+ err = -errno;
return err;
+ }
return 0;
}
static int avdtp_write(struct bluetooth_data *data)
{
- int ret = 0;
+ int err;
struct rtp_header *header;
struct rtp_payload *payload;
struct bluetooth_a2dp *a2dp = &data->a2dp;
header->timestamp = htonl(a2dp->nsamples);
header->ssrc = htonl(1);
- ret = send(data->stream.fd, a2dp->buffer, a2dp->count, MSG_DONTWAIT);
- if (ret < 0) {
- DBG("send returned %d errno %s.", ret, strerror(errno));
- ret = -errno;
+ err = send(data->stream.fd, a2dp->buffer, a2dp->count, MSG_DONTWAIT);
+ if (err < 0) {
+ err = -errno;
+ DBG("send failed: %s (%d)", strerror(-err), -err);
}
/* Reset buffer of data to send */
a2dp->samples = 0;
a2dp->seq_num++;
- return ret;
+ return err;
}
static snd_pcm_sframes_t bluetooth_a2dp_write(snd_pcm_ioplug_t *io,
else {
err = -errno;
SNDERR("Error sending data to audio service: %s(%d)",
- strerror(errno), errno);
+ strerror(-err), -err);
}
return err;
if (ret < 0) {
err = -errno;
SNDERR("Error receiving IPC data from bluetoothd: %s (%d)",
- strerror(errno), errno);
+ strerror(-err), -err);
} else if ((size_t) ret < sizeof(bt_audio_msg_header_t)) {
SNDERR("Too short (%d bytes) IPC packet from bluetoothd", ret);
err = -EINVAL;