libtriple: try to make all filedescriptors O_CLOEXEC

Origin commit data
------------------
Branch: master
Commit: 5a8f5b3b20
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-12-04 (Sun, 04 Dec 2011)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2011-12-04 15:54:49 +01:00
parent fa031cd359
commit 2e68df0142
5 changed files with 11 additions and 5 deletions

View File

@@ -35,6 +35,7 @@ void cAudio::openDevice(void)
{ {
if ((fd = open(AUDIO_DEVICE, O_RDWR)) < 0) if ((fd = open(AUDIO_DEVICE, O_RDWR)) < 0)
lt_info("openDevice: open failed (%m)\n"); lt_info("openDevice: open failed (%m)\n");
fcntl(fd, F_SETFD, FD_CLOEXEC);
} }
else else
lt_info("openDevice: already open (fd = %d)\n", fd); 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__); lt_info("%s open /dev/sound/dsp: %m\n", __FUNCTION__);
return -1; return -1;
} }
fcntl(clipfd, F_SETFD, FD_CLOEXEC);
/* no idea if we ever get little_endian == 0 */ /* no idea if we ever get little_endian == 0 */
if (little_endian) if (little_endian)
fmt = AFMT_S16_BE; fmt = AFMT_S16_BE;

View File

@@ -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]); lt_info("%s %s: %m\n", __FUNCTION__, devname[devnum]);
return false; return false;
} }
fcntl(fd, F_SETFD, FD_CLOEXEC);
lt_debug("%s #%d pes_type: %s (%d), uBufferSize: %d devname: %s fd: %d\n", __FUNCTION__, 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); 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); lt_info("%s #%d Pid = %hx open failed (%m)\n", __FUNCTION__, num, Pid);
return false; return false;
} }
fcntl(pfd.fd, F_SETFD, FD_CLOEXEC);
lt_debug("%s #%d Pid = %hx pfd = %d\n", __FUNCTION__, num, Pid, pfd.fd); lt_debug("%s #%d Pid = %hx pfd = %d\n", __FUNCTION__, num, Pid, pfd.fd);
p.pid = Pid; p.pid = Pid;

View File

@@ -127,6 +127,7 @@ void init_td_api()
gfxfd = open("/dev/stb/tdgfx", O_RDWR); gfxfd = open("/dev/stb/tdgfx", O_RDWR);
if (gfxfd < 0) if (gfxfd < 0)
perror("open /dev/stb/tdgfx"); perror("open /dev/stb/tdgfx");
fcntl(gfxfd, F_SETFD, FD_CLOEXEC);
} }
initialized = true; initialized = true;
lt_info("%s end\n", __FUNCTION__); lt_info("%s end\n", __FUNCTION__);

View File

@@ -260,6 +260,7 @@ void cPlayback::playthread(void)
lt_info("%s open tdpvr failed: %m\n", __FUNCTION__); lt_info("%s open tdpvr failed: %m\n", __FUNCTION__);
pthread_exit(NULL); pthread_exit(NULL);
} }
fcntl(dvrfd, F_SETFD, FD_CLOEXEC);
pthread_cleanup_push(playthread_cleanup_handler, 0); pthread_cleanup_push(playthread_cleanup_handler, 0);
@@ -657,6 +658,7 @@ int cPlayback::mf_open(int fileno)
mf_close(); mf_close();
in_fd = open(filelist[fileno].Name.c_str(), O_RDONLY); in_fd = open(filelist[fileno].Name.c_str(), O_RDONLY);
fcntl(in_fd, F_SETFD, FD_CLOEXEC);
if (in_fd != -1) if (in_fd != -1)
curr_fileno = fileno; curr_fileno = fileno;

View File

@@ -1,11 +1,10 @@
/* /*
* $Id$
*
* (C) 2002-2003 Andreas Oberritter <obi@tuxbox.org> * (C) 2002-2003 Andreas Oberritter <obi@tuxbox.org>
* (C) 2010-2011 Stefan Seyfried
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * 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 * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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 <fcntl.h> #include <fcntl.h>
@@ -74,6 +72,7 @@ cVideo::cVideo(int, void *, void *)
lt_debug("%s\n", __FUNCTION__); lt_debug("%s\n", __FUNCTION__);
if ((fd = open(VIDEO_DEVICE, O_RDWR)) < 0) if ((fd = open(VIDEO_DEVICE, O_RDWR)) < 0)
lt_info("%s cannot open %s: %m\n", __FUNCTION__, VIDEO_DEVICE); lt_info("%s cannot open %s: %m\n", __FUNCTION__, VIDEO_DEVICE);
fcntl(fd, F_SETFD, FD_CLOEXEC);
playstate = VIDEO_STOPPED; playstate = VIDEO_STOPPED;
croppingMode = VID_DISPMODE_NORM; croppingMode = VID_DISPMODE_NORM;