Commit aef4a77d authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

wineoss: Proper support in OSS driver for audio when no mixer is present.

Fixed a couple of potential fd leaks.
parent df5bd5f8
...@@ -740,9 +740,7 @@ static BOOL OSS_WaveOutInit(OSS_DEVICE* ossdev) ...@@ -740,9 +740,7 @@ static BOOL OSS_WaveOutInit(OSS_DEVICE* ossdev)
} }
close(mixer); close(mixer);
} else { } else {
ERR("open(%s) failed (%s)\n", ossdev->mixer_name , strerror(errno)); WARN("open(%s) failed (%s)\n", ossdev->mixer_name , strerror(errno));
OSS_CloseDevice(ossdev);
return FALSE;
} }
} }
#endif /* SOUND_MIXER_INFO */ #endif /* SOUND_MIXER_INFO */
...@@ -892,9 +890,7 @@ static BOOL OSS_WaveInInit(OSS_DEVICE* ossdev) ...@@ -892,9 +890,7 @@ static BOOL OSS_WaveInInit(OSS_DEVICE* ossdev)
} }
close(mixer); close(mixer);
} else { } else {
ERR("open(%s) failed (%s)\n", ossdev->mixer_name, strerror(errno)); WARN("open(%s) failed (%s)\n", ossdev->mixer_name, strerror(errno));
OSS_CloseDevice(ossdev);
return FALSE;
} }
} }
#endif /* SOUND_MIXER_INFO */ #endif /* SOUND_MIXER_INFO */
...@@ -2254,6 +2250,7 @@ static DWORD wodGetVolume(WORD wDevID, LPDWORD lpdwVol) ...@@ -2254,6 +2250,7 @@ static DWORD wodGetVolume(WORD wDevID, LPDWORD lpdwVol)
return MMSYSERR_NOTENABLED; return MMSYSERR_NOTENABLED;
} }
if (ioctl(mixer, SOUND_MIXER_READ_PCM, &volume) == -1) { if (ioctl(mixer, SOUND_MIXER_READ_PCM, &volume) == -1) {
close(mixer);
WARN("ioctl(%s, SOUND_MIXER_READ_PCM) failed (%s)\n", WARN("ioctl(%s, SOUND_MIXER_READ_PCM) failed (%s)\n",
WOutDev[wDevID].ossdev->mixer_name, strerror(errno)); WOutDev[wDevID].ossdev->mixer_name, strerror(errno));
return MMSYSERR_NOTENABLED; return MMSYSERR_NOTENABLED;
...@@ -2297,12 +2294,12 @@ DWORD wodSetVolume(WORD wDevID, DWORD dwParam) ...@@ -2297,12 +2294,12 @@ DWORD wodSetVolume(WORD wDevID, DWORD dwParam)
return MMSYSERR_NOTENABLED; return MMSYSERR_NOTENABLED;
} }
if (ioctl(mixer, SOUND_MIXER_WRITE_PCM, &volume) == -1) { if (ioctl(mixer, SOUND_MIXER_WRITE_PCM, &volume) == -1) {
close(mixer);
WARN("ioctl(%s, SOUND_MIXER_WRITE_PCM) failed (%s)\n", WARN("ioctl(%s, SOUND_MIXER_WRITE_PCM) failed (%s)\n",
WOutDev[wDevID].ossdev->mixer_name, strerror(errno)); WOutDev[wDevID].ossdev->mixer_name, strerror(errno));
return MMSYSERR_NOTENABLED; return MMSYSERR_NOTENABLED;
} else {
TRACE("volume=%04x\n", (unsigned)volume);
} }
TRACE("volume=%04x\n", (unsigned)volume);
close(mixer); close(mixer);
/* save requested volume */ /* save requested volume */
......
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