[vlc-commits] v4l2 output: fix O_CLOEXEC definition for older kernels

Francois Cartegnie git at videolan.org
Tue Jan 17 16:41:22 CET 2012


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jan 17 16:40:11 2012 +0100| [34ec64f46e667fa2ea0acd07a10de0ecc62dd656] | committer: Francois Cartegnie

v4l2 output: fix O_CLOEXEC definition for older kernels

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=34ec64f46e667fa2ea0acd07a10de0ecc62dd656
---

 modules/video_output/v4l2_output.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/modules/video_output/v4l2_output.c b/modules/video_output/v4l2_output.c
index f44bf2a..92752ee 100644
--- a/modules/video_output/v4l2_output.c
+++ b/modules/video_output/v4l2_output.c
@@ -279,6 +279,9 @@ static int Open (vlc_object_t *obj)
     vd->sys = calloc( 1, sizeof(vout_display_sys_t) );
     if ( !vd->sys ) goto earlyerror;
 
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
     vd->sys->fd = open( psz_video_device, O_RDWR|O_NONBLOCK|O_CLOEXEC );
     if (vd->sys->fd < 0)
     {
@@ -286,6 +289,7 @@ static int Open (vlc_object_t *obj)
         free(vd->sys);
         goto earlyerror;
     }
+    if( !O_CLOEXEC ) fcntl( vd->sys->fd, F_SETFD, FD_CLOEXEC );
 
     if ( ioctl(vd->sys->fd, VIDIOC_QUERYCAP, &vid_caps) < 0 )
     {



More information about the vlc-commits mailing list