From dd14f1ec2cb772d731570df54bbc9e10eae9e018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Tue, 19 Feb 2019 17:16:19 +0100 Subject: cam: improve error checking when capturing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The return value when start() and stop() the camera should be checked and handled. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/cam/main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cam/main.cpp b/src/cam/main.cpp index 0c66a98e..70d86bcf 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -180,11 +180,18 @@ static int capture() } std::cout << "Capture until user interrupts by SIGINT" << std::endl; - camera->start(); + + ret = camera->start(); + if (ret) { + std::cout << "Failed to start capture" << std::endl; + goto out; + } ret = loop->exec(); - camera->stop(); + ret = camera->stop(); + if (ret) + std::cout << "Failed to stop capture" << std::endl; out: camera->freeBuffers(); -- cgit v1.2.1