libcamera: v4l2_videodevice: Use FileDescriptor "fd move" constructor
Use the newly added "fd move" constructor of the FileDescriptor class to avoid dup() + close(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
This commit is contained in:
parent
c7463138c6
commit
dfa25e1833
1 changed files with 1 additions and 8 deletions
|
@ -1276,14 +1276,7 @@ FileDescriptor V4L2VideoDevice::exportDmabufFd(unsigned int index,
|
|||
return FileDescriptor();
|
||||
}
|
||||
|
||||
FileDescriptor fd(expbuf.fd);
|
||||
/*
|
||||
* FileDescriptor takes a duplicate of fd, so we must close the
|
||||
* original here, otherwise it will be left dangling.
|
||||
*/
|
||||
::close(expbuf.fd);
|
||||
|
||||
return fd;
|
||||
return FileDescriptor(std::move(expbuf.fd));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue