[libcamera-devel] [PATCH] libcamera: process: Fail loudly on isolate
Jacopo Mondi
jacopo at jmondi.org
Fri Jul 19 10:05:56 CEST 2019
Add an error debug message when disassociating part of a process
execution context using unshare fails.
As this is currently used to isolate a child process which is
immediately terminated silently if unshare fails, add a debug printout
and propagate up the error code to make the failure more visible.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/libcamera/process.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp
index 6c41da219f05..ab716a9cd57f 100644
--- a/src/libcamera/process.cpp
+++ b/src/libcamera/process.cpp
@@ -306,7 +306,15 @@ void Process::closeAllFdsExcept(const std::vector<int> &fds)
int Process::isolate()
{
- return unshare(CLONE_NEWUSER | CLONE_NEWNET);
+ int ret = unshare(CLONE_NEWUSER | CLONE_NEWNET);
+ if (ret) {
+ ret = -errno;
+ LOG(Process, Error) << "Failed to unshare execution context: "
+ << strerror(-ret);
+ return ret;
+ }
+
+ return 0;
}
/**
--
2.21.0
More information about the libcamera-devel
mailing list