On Wed, 04.11.09 20:38, Rémi Denis-Courmont (remi@xxxxxxxxxx) wrote: > static inline int snd_open_device(const char *filename, int fmode) > { > - int fd = open(filename, fmode); > + int fd; > + > +#ifdef O_CLOEXEC > + fd = open(filename, fmode|O_CLOEXEC); > if (fd >= 0) > return fd; > + if (errno == EINVAL) > +#endif > + { > + fd = open(filename, fmode); > + if (fd >= 0) { > + fcntl(fd, F_SETFD, FD_CLOEXEC); > + return fd; > + } That's actually not how things works. O_CLOEXEC is silently ignored by old kernels. (The calls with SOCK_CLOEXEC fail with EINVAL while the calls with O_CLOEXEC silently succeed) You need to set FD_CLOEXEC unconditionally to cover all cases: fd = open(fn, fmode #ifdef O_CLOEXEC |O_CLOEXEC #endif ); fcntl(fd, F_SETFD, FD_CLOEXEC); Lennart -- Lennart Poettering Red Hat, Inc. lennart [at] poettering [dot] net http://0pointer.net/lennart/ GnuPG 0x1A015CC4 _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel