diff options
author | Anderson Lizardo <anderson.lizardo@openbossa.org> | 2011-11-16 09:19:49 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2011-11-17 13:57:52 +0200 |
commit | f2c10b575c32fae045a84703762e179e47d25760 (patch) | |
tree | 0af0e2e8ba4fa568042b6be69dd7a7c586f33172 /audio | |
parent | e4e02ce6577de874a6a5fe508e4dc07ec8ed034e (diff) |
AVDTP: 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 'audio')
-rw-r--r-- | audio/gstavdtpsink.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/audio/gstavdtpsink.c b/audio/gstavdtpsink.c index 0f3abf32e..f3794692c 100644 --- a/audio/gstavdtpsink.c +++ b/audio/gstavdtpsink.c @@ -279,10 +279,10 @@ static gint gst_avdtp_sink_bluetooth_recvmsg_fd(GstAvdtpSink *sink) g_io_channel_unix_get_fd(sink->server)); if (ret < 0) { - err = errno; + err = -errno; GST_ERROR_OBJECT(sink, "Unable to receive fd: %s (%d)", - strerror(err), err); - return -err; + strerror(-err), -err); + return err; } sink->stream = g_io_channel_unix_new(ret); @@ -1449,9 +1449,9 @@ static gboolean gst_avdtp_sink_start(GstBaseSink *basesink) sk = bt_audio_service_open(); if (sk <= 0) { - err = errno; + err = -errno; GST_ERROR_OBJECT(self, "Cannot open connection to bt " - "audio service: %s %d", strerror(err), err); + "audio service: %s %d", strerror(-err), -err); goto failed; } @@ -1841,7 +1841,7 @@ static int gst_avdtp_sink_audioservice_send(GstAvdtpSink *self, ssize_t written; const char *type, *name; uint16_t length; - int fd; + int fd, err; length = msg->length ? msg->length : BT_SUGGESTED_BUFFER_SIZE; @@ -1849,9 +1849,10 @@ static int gst_avdtp_sink_audioservice_send(GstAvdtpSink *self, written = write(fd, msg, length); if (written < 0) { + err = -errno; GST_ERROR_OBJECT(self, "Error sending data to audio service:" - " %s", strerror(errno)); - return -errno; + " %s", strerror(-err)); + return err; } type = bt_audio_strtype(msg->type); @@ -1876,9 +1877,10 @@ static int gst_avdtp_sink_audioservice_recv(GstAvdtpSink *self, bytes_read = read(fd, inmsg, length); if (bytes_read < 0) { + err = -errno; GST_ERROR_OBJECT(self, "Error receiving data from " - "audio service: %s", strerror(errno)); - return -errno; + "audio service: %s", strerror(-err)); + return err; } type = bt_audio_strtype(inmsg->type); |