Warn if open_count is already 0 when OSS_CloseDevice is called.

Don't decrement it in that case.
This commit is contained in:
Francois Gouget 2003-01-16 01:16:46 +00:00 committed by Alexandre Julliard
parent cd0219e941
commit 9140349886
1 changed files with 6 additions and 1 deletions

View File

@ -370,7 +370,12 @@ static DWORD OSS_OpenDevice(OSS_DEVICE* ossdev, unsigned req_access,
*/
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 */
ioctl(ossdev->fd, SNDCTL_DSP_RESET, 0);