From 5a1728c8d4f4aaf50d1d2fe4740c74ba5c0d61d2 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Fri, 18 May 2018 17:46:02 +0200 Subject: [PATCH] container: ensure the socket path we're using exists --- src/anbox/container/service.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/anbox/container/service.cpp b/src/anbox/container/service.cpp index b84d7db..29bd1b5 100644 --- a/src/anbox/container/service.cpp +++ b/src/anbox/container/service.cpp @@ -28,6 +28,10 @@ #include "anbox/rpc/channel.h" #include "anbox/rpc/pending_call_cache.h" +#include + +namespace fs = boost::filesystem; + namespace anbox { namespace container { std::shared_ptr Service::create(const std::shared_ptr &rt, bool privileged) { @@ -41,6 +45,10 @@ std::shared_ptr Service::create(const std::shared_ptr &rt, boo }); const auto container_socket_path = SystemConfiguration::instance().container_socket_path(); + const auto socket_parent_path = fs::path(container_socket_path).parent_path(); + if (!fs::exists(socket_parent_path)) + fs::create_directories(socket_parent_path); + sp->connector_ = std::make_shared(container_socket_path, rt, delegate_connector); // Make sure others can connect to our socket