diff --git a/libtriple/audio_td.cpp b/libtriple/audio_td.cpp index 9305356..3001bbc 100644 --- a/libtriple/audio_td.cpp +++ b/libtriple/audio_td.cpp @@ -35,6 +35,7 @@ void cAudio::openDevice(void) { if ((fd = open(AUDIO_DEVICE, O_RDWR)) < 0) lt_info("openDevice: open failed (%m)\n"); + fcntl(fd, F_SETFD, FD_CLOEXEC); } else lt_info("openDevice: already open (fd = %d)\n", fd); @@ -185,6 +186,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) lt_info("%s open /dev/sound/dsp: %m\n", __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; diff --git a/libtriple/dmx_td.cpp b/libtriple/dmx_td.cpp index a0aac16..a912e8f 100644 --- a/libtriple/dmx_td.cpp +++ b/libtriple/dmx_td.cpp @@ -99,6 +99,7 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe lt_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); return false; } + fcntl(fd, F_SETFD, FD_CLOEXEC); lt_debug("%s #%d pes_type: %s (%d), uBufferSize: %d devname: %s fd: %d\n", __FUNCTION__, num, DMX_T[pes_type], pes_type, uBufferSize, devname[devnum], fd); @@ -510,6 +511,7 @@ bool cDemux::addPid(unsigned short Pid) lt_info("%s #%d Pid = %hx open failed (%m)\n", __FUNCTION__, num, Pid); return false; } + fcntl(pfd.fd, F_SETFD, FD_CLOEXEC); lt_debug("%s #%d Pid = %hx pfd = %d\n", __FUNCTION__, num, Pid, pfd.fd); p.pid = Pid; diff --git a/libtriple/init_td.cpp b/libtriple/init_td.cpp index bfd2e17..10a616f 100644 --- a/libtriple/init_td.cpp +++ b/libtriple/init_td.cpp @@ -127,6 +127,7 @@ void init_td_api() gfxfd = open("/dev/stb/tdgfx", O_RDWR); if (gfxfd < 0) perror("open /dev/stb/tdgfx"); + fcntl(gfxfd, F_SETFD, FD_CLOEXEC); } initialized = true; lt_info("%s end\n", __FUNCTION__); diff --git a/libtriple/playback_td.cpp b/libtriple/playback_td.cpp index 3242be3..6397e93 100644 --- a/libtriple/playback_td.cpp +++ b/libtriple/playback_td.cpp @@ -260,6 +260,7 @@ void cPlayback::playthread(void) lt_info("%s open tdpvr failed: %m\n", __FUNCTION__); pthread_exit(NULL); } + fcntl(dvrfd, F_SETFD, FD_CLOEXEC); pthread_cleanup_push(playthread_cleanup_handler, 0); @@ -657,6 +658,7 @@ int cPlayback::mf_open(int fileno) mf_close(); in_fd = open(filelist[fileno].Name.c_str(), O_RDONLY); + fcntl(in_fd, F_SETFD, FD_CLOEXEC); if (in_fd != -1) curr_fileno = fileno; diff --git a/libtriple/video_td.cpp b/libtriple/video_td.cpp index 85fc8e2..2ad99d5 100644 --- a/libtriple/video_td.cpp +++ b/libtriple/video_td.cpp @@ -1,11 +1,10 @@ /* - * $Id$ - * * (C) 2002-2003 Andreas Oberritter + * (C) 2010-2011 Stefan Seyfried * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -15,8 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * + * Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA */ #include @@ -74,6 +72,7 @@ cVideo::cVideo(int, void *, void *) lt_debug("%s\n", __FUNCTION__); if ((fd = open(VIDEO_DEVICE, O_RDWR)) < 0) lt_info("%s cannot open %s: %m\n", __FUNCTION__, VIDEO_DEVICE); + fcntl(fd, F_SETFD, FD_CLOEXEC); playstate = VIDEO_STOPPED; croppingMode = VID_DISPMODE_NORM;