The alsa-lib doesn't set the close-on-exec flag on its PCM device FD's.
The consequence is that processes spawned by alsa-lib clients inherit an
open file handle to the PCM device and thereby block it.

For example, mplayer can disable and re-launch the xscreensaver daemon.
In the alsa-enabled version of mplayer, the xscreensaver process
inherits a pcm handle, although xss can't make use of it. This
effectively forces me to restart xss manually after each mplayer
session.

Suggested fix:

--- src/pcm/pcm_hw.c.orig       2002-10-12 13:49:54.000000000 +0200
+++ src/pcm/pcm_hw.c    2003-02-03 23:07:14.000000000 +0100
@@ -867,6 +867,11 @@
                ret = -errno;
                goto _err;
        }
+       if( fcntl( fd, F_SETFD, FD_CLOEXEC ) != 0 ) {
+               SYSERR("fcntl FD_CLOEXEC failed");
+               ret = -errno;
+               goto _err;
+       }
        if (ioctl(fd, SNDRV_PCM_IOCTL_PVERSION, &ver) < 0) {
                SYSERR("SNDRV_PCM_IOCTL_PVERSION failed");
                ret = -errno;

-- 
Best Regards,   |   Hi! I'm a .signature virus. Copy me into
 Sebastian      |   your ~/.signature to help me spread!

Attachment: msg06249/pgp00000.pgp
Description: PGP signature

Reply via email to