Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE
alsa.5967
0003-pcm-Fix-shm-initialization-race-condition....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-pcm-Fix-shm-initialization-race-condition.patch of Package alsa.5967
From 7640856769d2d687877df720af5ef1ecd8938888 Mon Sep 17 00:00:00 2001 From: Ismael Luceno <ismael@iodev.co.uk> Date: Mon, 22 Aug 2016 13:04:33 -0300 Subject: [PATCH] pcm: Fix shm initialization race-condition Easily seen when two threads try at the same time, one of them will fail. The bug was identified by using apulse with Skype. Fixes: dec428c35221 ("pcm: fix 'unable to create IPC shm instance' caused by fork from a thread") Fixes: https://github.com/i-rinat/apulse/issues/38 Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Signed-off-by: Takashi Iwai <tiwai@suse.de> --- src/pcm/pcm_direct.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c index c3925cc20fd3..643498375b34 100644 --- a/src/pcm/pcm_direct.c +++ b/src/pcm/pcm_direct.c @@ -96,11 +96,12 @@ int snd_pcm_direct_shm_create_or_connect(snd_pcm_direct_t *dmix) retryget: dmix->shmid = shmget(dmix->ipc_key, sizeof(snd_pcm_direct_share_t), dmix->ipc_perm); - if (dmix->shmid < 0) { - if (errno == ENOENT) + if (dmix->shmid < 0 && errno == ENOENT) { if ((dmix->shmid = shmget(dmix->ipc_key, sizeof(snd_pcm_direct_share_t), IPC_CREAT | IPC_EXCL | dmix->ipc_perm)) != -1) first_instance = 1; + else if (errno == EEXIST) + goto retryget; } err = -errno; if (dmix->shmid < 0) { -- 2.10.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor