summaryrefslogtreecommitdiff
path: root/src/libcamera/process.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-07-19 09:24:37 +0200
committerJacopo Mondi <jacopo@jmondi.org>2019-07-31 15:29:56 +0200
commit119428fa1cbfd089961cf7b743dae55e06f06bf7 (patch)
tree73ca57d4b8dcb78360c7d2062f9f5987f1e6c380 /src/libcamera/process.cpp
parent9e6147d30392178abffd7c71426dc70250127ce2 (diff)
libcamera: process: Fail loudly on isolate
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. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/process.cpp')
-rw-r--r--src/libcamera/process.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp
index 6c41da21..ab716a9c 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;
}
/**