From 8f4e16f014c820a0ecb85e28453b88c277bc859f Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Tue, 22 Dec 2020 13:50:20 +0000 Subject: test: file: Check that directories are not treated as files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- test/file.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/file.cpp b/test/file.cpp index f458f355..b80667ae 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; -- cgit v1.2.1