[libcamera-devel] [PATCH] Avoid Segmentation Fault when use --help parameter
Emmanuel Arias
eamanu at eamanu.com
Mon Jun 3 03:57:49 CEST 2019
When Cam::parseOptions receive help args return -EINTR and
Cam::init return 0 to main. But the first if does not return EXIT_FAILURE
and continue. That launch a SegFaults
---
src/cam/main.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cam/main.cpp b/src/cam/main.cpp
index dbf0491..d23390a 100644
--- a/src/cam/main.cpp
+++ b/src/cam/main.cpp
@@ -61,7 +61,7 @@ int CamApp::init(int argc, char **argv)
ret = parseOptions(argc, argv);
if (ret < 0)
- return ret == -EINTR ? 0 : ret;
+ return ret == -EINTR ? -EINTR : ret;
cm_ = CameraManager::instance();
@@ -196,7 +196,7 @@ int main(int argc, char **argv)
if (app.init(argc, argv))
return EXIT_FAILURE;
-
+
struct sigaction sa = {};
sa.sa_handler = &signalHandler;
sigaction(SIGINT, &sa, nullptr);
--
2.11.0
More information about the libcamera-devel
mailing list