diff options
author | malc <av1474@comtv.ru> | 2009-10-02 02:37:40 +0400 |
---|---|---|
committer | malc <av1474@comtv.ru> | 2009-10-02 02:37:40 +0400 |
commit | 301901b56c75e4e2ec65ed7598cd69b9d5fb4fe3 (patch) | |
tree | 51b658a1cdaefac04a0aab16d2f4954ebc23d609 /audio/alsaaudio.c | |
parent | c227f0995e1722a1abccc28cadf0664266bd8043 (diff) |
oss/alsa: Do not invoke UB described in 7.15.1.1
Additional argument (whether to try poll mode) is only passed with
VOICE_ENABLE command.
Thanks to Markus Armbruster for noticing the potential breakage.
Diffstat (limited to 'audio/alsaaudio.c')
-rw-r--r-- | audio/alsaaudio.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index a4baebcb40..b8de3a708d 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -861,22 +861,25 @@ static int alsa_voice_ctl (snd_pcm_t *handle, const char *typ, int pause) static int alsa_ctl_out (HWVoiceOut *hw, int cmd, ...) { - va_list ap; - int poll_mode; ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; - va_start (ap, cmd); - poll_mode = va_arg (ap, int); - va_end (ap); - switch (cmd) { case VOICE_ENABLE: - ldebug ("enabling voice\n"); - if (poll_mode && alsa_poll_out (hw)) { - poll_mode = 0; + { + va_list ap; + int poll_mode; + + va_start (ap, cmd); + poll_mode = va_arg (ap, int); + va_end (ap); + + ldebug ("enabling voice\n"); + if (poll_mode && alsa_poll_out (hw)) { + poll_mode = 0; + } + hw->poll_mode = poll_mode; + return alsa_voice_ctl (alsa->handle, "playback", 0); } - hw->poll_mode = poll_mode; - return alsa_voice_ctl (alsa->handle, "playback", 0); case VOICE_DISABLE: ldebug ("disabling voice\n"); |