libcamera: Open files with O_CLOEXEC
Files opened internally in libcamera without the O_CLOEXEC file will remain open upon a call to one of the exec(3) functions. As exec() doesn't destroy local or global objects, this can lead to various side effects. Avoid this by opening file descriptors with O_CLOEXEC for all internal files. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
@@ -477,7 +477,7 @@ int MediaDevice::open()
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
fd_ = UniqueFD(::open(deviceNode_.c_str(), O_RDWR));
|
||||
fd_ = UniqueFD(::open(deviceNode_.c_str(), O_RDWR | O_CLOEXEC));
|
||||
if (!fd_.isValid()) {
|
||||
int ret = -errno;
|
||||
LOG(MediaDevice, Error)
|
||||
|
||||
Reference in New Issue
Block a user