[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] litle fix for oss output driver
From: |
Halim Sahin |
Subject: |
[PATCH] litle fix for oss output driver |
Date: |
Wed, 4 Aug 2010 10:52:07 +0200 |
The driver checked the filedescriptor wrong.
Invalid ones should have the vallue < 0 and vallid ones >= 0.
Signed-off-by: Halim Sahin <halim.sahin at t-online.de>
---
src/audio/oss.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/audio/oss.c b/src/audio/oss.c
index 813e5d3..95dfaf2 100644
--- a/src/audio/oss.c
+++ b/src/audio/oss.c
@@ -88,7 +88,7 @@ _oss_open(AudioID *id)
pthread_mutex_lock(&id->fd_mutex);
id->fd = open(id->device_name, O_WRONLY, 0);
- if (id->fd == -1){
+ if (id->fd < 0){
perror(id->device_name);
pthread_mutex_unlock(&id->fd_mutex);
id = NULL;
@@ -105,11 +105,11 @@ _oss_close(AudioID *id)
{
MSG(1, "_oss_close()")
if (id == NULL) return 0;
- if (id->fd == 0) return 0;
+ if (id->fd < 0) return 0;
pthread_mutex_lock(&id->fd_mutex);
close(id->fd);
- id->fd = 0;
+ id->fd = -1;
pthread_mutex_unlock(&id->fd_mutex);
return 0;
}
@@ -407,7 +407,7 @@ oss_stop(AudioID *id)
/* Stop the playback on /dev/dsp */
pthread_mutex_lock(&id->fd_mutex);
- if (id->fd != 0)
+ if (id->fd >= 0)
ret = ioctl(id->fd, SNDCTL_DSP_RESET, 0);
pthread_mutex_unlock(&id->fd_mutex);
if (ret == -1){
--
1.6.4.4
- [PATCH] litle fix for oss output driver,
Halim Sahin <=