mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-29 19:50:40 +00:00
bluez: 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.
This commit is contained in:
parent
64c0532017
commit
86c2797eef
1 changed files with 12 additions and 10 deletions
|
@ -282,10 +282,10 @@ gst_avdtp_sink_bluetooth_recvmsg_fd (GstAvdtpSink * sink)
|
|||
ret = bt_audio_service_get_data_fd (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);
|
||||
|
@ -1441,9 +1441,9 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -1811,7 +1811,7 @@ 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;
|
||||
|
||||
|
@ -1819,9 +1819,10 @@ 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);
|
||||
|
@ -1847,9 +1848,10 @@ 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);
|
||||
|
|
Loading…
Reference in a new issue