Commit 91403498 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Warn if open_count is already 0 when OSS_CloseDevice is called.

Don't decrement it in that case.
parent cd0219e9
...@@ -370,7 +370,12 @@ static DWORD OSS_OpenDevice(OSS_DEVICE* ossdev, unsigned req_access, ...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment