mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
Fix wrong return values in direct plugins
Fixed the codes returning error values that are not set properly via errno.
This commit is contained in:
parent
c13b8dc986
commit
408af4b675
1 changed files with 5 additions and 3 deletions
|
|
@ -109,13 +109,15 @@ retryget:
|
||||||
}
|
}
|
||||||
dmix->shmptr = shmat(dmix->shmid, 0, 0);
|
dmix->shmptr = shmat(dmix->shmid, 0, 0);
|
||||||
if (dmix->shmptr == (void *) -1) {
|
if (dmix->shmptr == (void *) -1) {
|
||||||
|
err = -errno;
|
||||||
snd_pcm_direct_shm_discard(dmix);
|
snd_pcm_direct_shm_discard(dmix);
|
||||||
return -errno;
|
return err;
|
||||||
}
|
}
|
||||||
mlock(dmix->shmptr, sizeof(snd_pcm_direct_share_t));
|
mlock(dmix->shmptr, sizeof(snd_pcm_direct_share_t));
|
||||||
if (shmctl(dmix->shmid, IPC_STAT, &buf) < 0) {
|
if (shmctl(dmix->shmid, IPC_STAT, &buf) < 0) {
|
||||||
|
err = -errno;
|
||||||
snd_pcm_direct_shm_discard(dmix);
|
snd_pcm_direct_shm_discard(dmix);
|
||||||
return -errno;
|
return err;
|
||||||
}
|
}
|
||||||
if (buf.shm_nattch == 1) { /* we're the first user, clear the segment */
|
if (buf.shm_nattch == 1) { /* we're the first user, clear the segment */
|
||||||
memset(dmix->shmptr, 0, sizeof(snd_pcm_direct_share_t));
|
memset(dmix->shmptr, 0, sizeof(snd_pcm_direct_share_t));
|
||||||
|
|
@ -128,7 +130,7 @@ retryget:
|
||||||
} else {
|
} else {
|
||||||
if (dmix->shmptr->magic != SND_PCM_DIRECT_MAGIC) {
|
if (dmix->shmptr->magic != SND_PCM_DIRECT_MAGIC) {
|
||||||
snd_pcm_direct_shm_discard(dmix);
|
snd_pcm_direct_shm_discard(dmix);
|
||||||
return -errno;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue