azbox: add O_CLOEXEC to open()

This commit is contained in:
Stefan Seyfried
2013-09-21 15:00:16 +02:00
parent 9338fc6d1f
commit ad64d0ab4f
3 changed files with 7 additions and 12 deletions

View File

@@ -39,9 +39,8 @@ void cAudio::openDevice(void)
lt_debug("%s\n", __func__);
if (fd < 0)
{
if ((fd = open(AUDIO_DEVICE, O_RDWR)) < 0)
if ((fd = open(AUDIO_DEVICE, O_RDONLY|O_CLOEXEC)) < 0)
lt_info("openDevice: open failed (%m)\n");
fcntl(fd, F_SETFD, FD_CLOEXEC);
do_mute(true, false);
}
else
@@ -211,12 +210,11 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
}
lt_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */
/* the tdoss dsp driver seems to work only on the second open(). really. */
clipfd = open(dsp_dev, O_WRONLY);
clipfd = open(dsp_dev, O_WRONLY|O_CLOEXEC);
if (clipfd < 0) {
lt_info("%s open %s: %m\n", dsp_dev, __FUNCTION__);
return -1;
}
fcntl(clipfd, F_SETFD, FD_CLOEXEC);
/* no idea if we ever get little_endian == 0 */
if (little_endian)
fmt = AFMT_S16_BE;
@@ -234,7 +232,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
if (!mix_dev)
return 0;
mixer_fd = open(mix_dev, O_RDWR);
mixer_fd = open(mix_dev, O_RDWR|O_CLOEXEC);
if (mixer_fd < 0) {
lt_info("%s: open mixer %s failed (%m)\n", __func__, mix_dev);
/* not a real error */