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

Laurent Aimar fenrir at elivagar.org
Tue Jan 17 20:33:05 CET 2012


On Tue, Jan 17, 2012 at 04:41:22PM +0100, Francois Cartegnie wrote:
> 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 );
 This is not acceptable, please use vlc_open() instead.

Regards,

-- 
fenrir



More information about the vlc-devel mailing list