Warn if open_count is already 0 when OSS_CloseDevice is called.
Don't decrement it in that case.
This commit is contained in:
parent
cd0219e941
commit
9140349886
|
@ -370,7 +370,12 @@ static DWORD OSS_OpenDevice(OSS_DEVICE* ossdev, unsigned req_access,
|
||||||
*/
|
*/
|
||||||
static void OSS_CloseDevice(OSS_DEVICE* ossdev)
|
static void OSS_CloseDevice(OSS_DEVICE* ossdev)
|
||||||
{
|
{
|
||||||
if (--ossdev->open_count == 0)
|
if (ossdev->open_count>0) {
|
||||||
|
ossdev->open_count--;
|
||||||
|
} else {
|
||||||
|
WARN("OSS_CloseDevice called too many times\n");
|
||||||
|
}
|
||||||
|
if (ossdev->open_count == 0)
|
||||||
{
|
{
|
||||||
/* reset the device before we close it in case it is in a bad state */
|
/* reset the device before we close it in case it is in a bad state */
|
||||||
ioctl(ossdev->fd, SNDCTL_DSP_RESET, 0);
|
ioctl(ossdev->fd, SNDCTL_DSP_RESET, 0);
|
||||||
|
|
Loading…
Reference in New Issue