aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTaylor Holberton <taylorcholberton@gmail.com>2016-11-22 09:54:47 -0800
committerTaylor Holberton <taylorcholberton@gmail.com>2016-11-22 09:54:47 -0800
commit72e442233b4f1306f9f1477762fd2ee0bf116c35 (patch)
treeca694993430c53f7b59de35edda148df1451cbae /src
parentb09056820223f92a955a21999d4e80fcabc56b8d (diff)
corrected error handling in pcm_sync_ptr()
Diffstat (limited to 'src')
-rw-r--r--src/pcm.c9
1 files changed, 7 insertions, 2 deletions
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;
}