[libcamera-devel] [PATCH 1/2] test: file: Check that directories are not treated as files

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Dec 22 16:51:43 CET 2020


Hi Kieran,

Thank you for the patch.

On Tue, Dec 22, 2020 at 01:58:48PM +0000, Kieran Bingham wrote:
> Directories can not be opened as a file, so the exists() check should
> not return true for a path which points to a directory.
> 
> Directories are not handled by the File class.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> ---
>  test/file.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/test/file.cpp b/test/file.cpp
> index f458f355ccad..b80667ae5b2f 100644
> --- a/test/file.cpp
> +++ b/test/file.cpp
> @@ -49,6 +49,11 @@ protected:
>  			return TestFail;
>  		}
>  
> +		if (File::exists("/dev")) {
> +			cerr << "Directories should not be treated as files" << endl;
> +			return TestFail;
> +		}
> +
>  		/* Test unnamed file. */
>  		File file;
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list