[RFC,v5,4/9] libcamera: process: Return error if already running
diff mbox series

Message ID 20250424114103.451395-5-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • libcamera: process: Remove `ProcessManager` singleton
Related show

Commit Message

Barnabás Pőcze April 24, 2025, 11:40 a.m. UTC
Returning 0 when a running process is already managed can be confusing
since the parameters might be completely different, causing the caller
to mistakenly assume that the program it specified has been started.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/process.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp
index c22c9af5d..ca9733d77 100644
--- a/src/libcamera/process.cpp
+++ b/src/libcamera/process.cpp
@@ -241,7 +241,7 @@  int Process::start(const std::string &path,
 	int ret;
 
 	if (pid_ > 0)
-		return 0;
+		return -EBUSY;
 
 	int childPid = fork();
 	if (childPid == -1) {