From 72e442233b4f1306f9f1477762fd2ee0bf116c35 Mon Sep 17 00:00:00 2001 From: Taylor Holberton Date: Tue, 22 Nov 2016 09:54:47 -0800 Subject: corrected error handling in pcm_sync_ptr() --- src/pcm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pcm.c b/src/pcm.c index 565e34b..2ceeb33 100644 --- a/src/pcm.c +++ b/src/pcm.c @@ -326,8 +326,9 @@ static int pcm_sync_ptr(struct pcm *pcm, int flags) pcm->sync_ptr->flags = flags; if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_SYNC_PTR, pcm->sync_ptr) < 0) return -1; + return 0; } - return 0; + return -1; } static int pcm_hw_mmap_status(struct pcm *pcm) @@ -1088,12 +1089,16 @@ int pcm_mmap_begin(struct pcm *pcm, void **areas, unsigned int *offset, int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames) { + int ret; + /* not used */ (void) offset; /* update the application pointer in userspace and kernel */ pcm_mmap_appl_forward(pcm, frames); - pcm_sync_ptr(pcm, 0); + ret = pcm_sync_ptr(pcm, 0); + if (ret != 0) + return ret; return frames; } -- cgit v1.2.3