From patchwork Tue Dec 22 13:58:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10694 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 2E942C0F1A for ; Tue, 22 Dec 2020 13:58:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E4278615B1; Tue, 22 Dec 2020 14:58:56 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="P2FLc5/w"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E106E6158A for ; Tue, 22 Dec 2020 14:58:54 +0100 (CET) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6BA24A1B; Tue, 22 Dec 2020 14:58:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1608645534; bh=OBNrnrqJW2DnMs6EmJ5KgbhJTJpvqM8D+XBPKjpj6dU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P2FLc5/wWnZefv7+YiDyQPL9IfDBLN79qCjawNESkbnwlchEPHJnfaTLj3uWfHXFT dULD3jQt1IaZBBJEdcvhUqfIGwdnnXWlVy/qHhwUaWg0vZ3mKxp/xC0TaZZYR56uTG rnpUmezWyuqmXOmUu7Fy3SG9peN9Veuzws645Vns= From: Kieran Bingham To: libcamera devel Date: Tue, 22 Dec 2020 13:58:48 +0000 Message-Id: <20201222135849.38052-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201222135849.38052-1-kieran.bingham@ideasonboard.com> References: <20201222135849.38052-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] test: file: Check that directories are not treated as files X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- 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;