mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
v4l2: Set O_CLOEXEC on the device fd
This is needed to make sure that child processes don't inherit the video device fd which can cause problems with some drivers.
This commit is contained in:
parent
9fee2c7c9f
commit
7b17615da8
1 changed files with 6 additions and 1 deletions
|
@ -25,6 +25,10 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE /* O_CLOEXEC */
|
||||
#endif
|
||||
|
||||
#include "gst/gst-i18n-plugin.h"
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
@ -124,7 +128,8 @@ gst_v4l2_probe_and_register (GstPlugin * plugin)
|
|||
if (video_fd >= 0)
|
||||
close (video_fd);
|
||||
|
||||
video_fd = open (it->device_path, O_RDWR);
|
||||
video_fd = open (it->device_path, O_RDWR | O_CLOEXEC);
|
||||
|
||||
if (video_fd == -1) {
|
||||
GST_DEBUG ("Failed to open %s: %s", it->device_path, g_strerror (errno));
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue