libcamera: file: Check files exist()

Ensure that when we check for existence with File() it will only return
if the path leads to a file, and not a directory.

Device nodes which could still be opened by this class are still
supported.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham
2020-11-30 23:25:40 +00:00
parent 8f4e16f014
commit 0a823785fa
+2 -1
View File
@@ -458,7 +458,8 @@ bool File::exists(const std::string &name)
if (ret < 0)
return false;
return true;
/* Directories can not be handled here, even if they exist. */
return !S_ISDIR(st.st_mode);
}
} /* namespace libcamera */