mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
libtriple: try to make all filedescriptors O_CLOEXEC
This commit is contained in:
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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__);
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -1,11 +1,10 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* (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
|
||||
* 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 <fcntl.h>
|
||||
@@ -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;
|
||||
|
Reference in New Issue
Block a user