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

Niklas Söderlund niklas.soderlund at ragnatech.se
Sun Dec 27 11:53:28 CET 2020


Hi Kieran,

On 2020-12-22 13:58:48 +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: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> ---
>  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;
>  
> -- 
> 2.25.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list