summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/base/shared_fd.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libcamera/base/shared_fd.cpp b/src/libcamera/base/shared_fd.cpp
index bd2ab5aa..c711cf57 100644
--- a/src/libcamera/base/shared_fd.cpp
+++ b/src/libcamera/base/shared_fd.cpp
@@ -253,6 +253,9 @@ SharedFD &SharedFD::operator=(SharedFD &&other)
*/
UniqueFD SharedFD::dup() const
{
+ if (!isValid())
+ return {};
+
UniqueFD dupFd(::dup(get()));
if (!dupFd.isValid()) {
int ret = -errno;