diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-09-06 07:33:06 +0000 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-09-06 07:33:06 +0000 | 
| commit | dc6a67eda727b063558e9ae95b05ed16110a3108 (patch) | |
| tree | 5458054b176304e0773d4a4cd7c7be5df58a5652 | |
| parent | 1332577eab21c33941c1b4d39b6bcb4a7777f0e4 (diff) | |
Check for valid stream fd after trying to receive it (and not before)
| -rw-r--r-- | audio/pcm_bluetooth.c | 9 | 
1 files changed, 5 insertions, 4 deletions
| diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c index 6338bc25..dd61089f 100644 --- a/audio/pcm_bluetooth.c +++ b/audio/pcm_bluetooth.c @@ -1211,15 +1211,15 @@ done:  			return ret;  	} +	ret = bluetooth_recvmsg_fd(data); +	if (ret < 0) +		return ret; +  	if (data->stream.fd == -1) {  		SNDERR("Error while configuring device: could not acquire audio socket");  		return -EINVAL;  	} -	ret = bluetooth_recvmsg_fd(data); -	if (ret < 0) -		return ret; -  	/* It is possible there is some outstanding  	data in the pipe - we have to empty it */  	while (recv(data->stream.fd, data->buffer, data->cfg.pkt_len, @@ -1244,6 +1244,7 @@ static int bluetooth_init(struct bluetooth_data *data, snd_pcm_stream_t stream,  	memset(data, 0, sizeof(struct bluetooth_data));  	data->server.fd = -1; +	data->stream.fd = -1;  	sk = socket(PF_LOCAL, SOCK_STREAM, 0);  	if (sk < 0) { | 
