summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-21 10:05:46 +0100
committerwm4 <wm4@nowhere>2014-11-21 10:09:26 +0100
commit9d2aef048d4740f497351f2d8029249e1914d837 (patch)
tree1fca0b2ebe31efb9d056f19ff448b43010920784
parentc6c46f5aa7045c365e2cbb6cc251319068744067 (diff)
downloadmpv-9d2aef048d4740f497351f2d8029249e1914d837.tar.bz2
mpv-9d2aef048d4740f497351f2d8029249e1914d837.tar.xz
ao_oss: check whether setting samplerate succeeds
Independent from whether the samplerate was accepted or adjusted, errors returned by the ioctl are fatal errors. Found by Coverity.
-rw-r--r--audio/out/ao_oss.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c
index 5dc1ea9830..826bb1cf2f 100644
--- a/audio/out/ao_oss.c
+++ b/audio/out/ao_oss.c
@@ -322,7 +322,8 @@ static int reopen_device(struct ao *ao, bool allow_format_changes)
#endif
if (AF_FORMAT_IS_IEC61937(format)) {
- ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &samplerate);
+ if (ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &samplerate) == -1)
+ goto fail;
// Probably could be fixed by setting number of channels; needs testing.
if (channels.num != 2) {
MP_ERR(ao, "Format %s not implemented.\n", af_fmt_to_str(format));
@@ -374,7 +375,8 @@ static int reopen_device(struct ao *ao, bool allow_format_changes)
MP_VERBOSE(ao, "using %d channels (requested: %d)\n",
channels.num, reqchannels);
// set rate
- ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &samplerate);
+ if (ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &samplerate) == -1)
+ goto fail;
MP_VERBOSE(ao, "using %d Hz samplerate\n", samplerate);
}