From cec39b3da3bab506fb63c4d312f0999ecf3530de Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 1 Feb 2009 17:35:13 -0800 Subject: Don't try to send an invalid SCO fd over the unix socket --- audio/unix.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/audio/unix.c b/audio/unix.c index ad311811..e30a2257 100644 --- a/audio/unix.c +++ b/audio/unix.c @@ -314,6 +314,13 @@ static void headset_resume_complete(struct audio_device *dev, void *user_data) goto failed; } + client->data_fd = headset_get_sco_fd(dev); + if (client->data_fd < 0) { + error("Unable to get a SCO fd"); + headset_unlock(client->dev, hs->lock); + goto failed; + } + memset(buf, 0, sizeof(buf)); rsp->h.type = BT_RESPONSE; rsp->h.name = BT_START_STREAM; @@ -328,8 +335,6 @@ static void headset_resume_complete(struct audio_device *dev, void *user_data) unix_ipc_sendmsg(client, &ind->h); - client->data_fd = headset_get_sco_fd(dev); - if (unix_sendmsg_fd(client->sock, client->data_fd) < 0) { error("unix_sendmsg_fd: %s(%d)", strerror(errno), errno); headset_unlock(client->dev, hs->lock); -- cgit