From 7b9178f5d7a7e6a948c393dd7d5895b1b06b219c Mon Sep 17 00:00:00 2001 From: Robert Swiecki Date: Sun, 11 Feb 2018 04:02:43 +0100 Subject: [PATCH] make indent depend --- cgroup.cc | 6 ++++-- net.cc | 4 +++- nsjail.h | 16 ++++++++-------- subproc.cc | 2 +- user.cc | 4 ++-- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/cgroup.cc b/cgroup.cc index 6f78ffb..8d88e43 100644 --- a/cgroup.cc +++ b/cgroup.cc @@ -125,7 +125,8 @@ static bool initNsFromParentNetCls(nsjconf_t* nsjconf, pid_t pid) { char net_cls_cgroup_path[PATH_MAX]; snprintf(net_cls_cgroup_path, sizeof(net_cls_cgroup_path), "%s/%s/NSJAIL.%d", - nsjconf->cgroup_net_cls_mount.c_str(), nsjconf->cgroup_net_cls_parent.c_str(), (int)pid); + nsjconf->cgroup_net_cls_mount.c_str(), nsjconf->cgroup_net_cls_parent.c_str(), + (int)pid); LOG_D("Create '%s' for PID=%d", net_cls_cgroup_path, (int)pid); if (mkdir(net_cls_cgroup_path, 0700) == -1 && errno != EEXIST) { PLOG_E("mkdir('%s', 0700) failed", net_cls_cgroup_path); @@ -267,7 +268,8 @@ void finishFromParentNetCls(nsjconf_t* nsjconf, pid_t pid) { } char net_cls_cgroup_path[PATH_MAX]; snprintf(net_cls_cgroup_path, sizeof(net_cls_cgroup_path), "%s/%s/NSJAIL.%d", - nsjconf->cgroup_net_cls_mount.c_str(), nsjconf->cgroup_net_cls_parent.c_str(), (int)pid); + nsjconf->cgroup_net_cls_mount.c_str(), nsjconf->cgroup_net_cls_parent.c_str(), + (int)pid); LOG_D("Remove '%s'", net_cls_cgroup_path); if (rmdir(net_cls_cgroup_path) == -1) { PLOG_W("rmdir('%s') failed", net_cls_cgroup_path); diff --git a/net.cc b/net.cc index 46c70de..f40407e 100644 --- a/net.cc +++ b/net.cc @@ -135,7 +135,9 @@ bool initNsFromParent(nsjconf_t* nsjconf, int pid) { char pid_str[256]; snprintf(pid_str, sizeof(pid_str), "%d", pid); - const std::vector argv {"/sbin/ip", "link", "add", "link", (char*)nsjconf->iface_vs.c_str(), "name", IFACE_NAME, "netns", pid_str, "type", "macvlan", "mode", "bridge" }; + const std::vector argv{"/sbin/ip", "link", "add", "link", + (char*)nsjconf->iface_vs.c_str(), "name", IFACE_NAME, "netns", pid_str, "type", + "macvlan", "mode", "bridge"}; if (subproc::systemExe(argv, environ) != 0) { LOG_E("Couldn't create MACVTAP interface for '%s'", nsjconf->iface_vs.c_str()); return false; diff --git a/nsjail.h b/nsjail.h index c1a62cb..b7bd1e6 100644 --- a/nsjail.h +++ b/nsjail.h @@ -127,17 +127,17 @@ struct nsjconf_t { std::string iface_vs_ip; std::string iface_vs_nm; std::string iface_vs_gw; - std::string cgroup_mem_mount; - std::string cgroup_mem_parent; + std::string cgroup_mem_mount; + std::string cgroup_mem_parent; size_t cgroup_mem_max; - std::string cgroup_pids_mount; - std::string cgroup_pids_parent; + std::string cgroup_pids_mount; + std::string cgroup_pids_parent; unsigned int cgroup_pids_max; - std::string cgroup_net_cls_mount; - std::string cgroup_net_cls_parent; + std::string cgroup_net_cls_mount; + std::string cgroup_net_cls_parent; unsigned int cgroup_net_cls_classid; - std::string cgroup_cpu_mount; - std::string cgroup_cpu_parent; + std::string cgroup_cpu_mount; + std::string cgroup_cpu_parent; unsigned int cgroup_cpu_ms_per_sec; std::string kafel_file_path; std::string kafel_string; diff --git a/subproc.cc b/subproc.cc index f045dd6..4752465 100644 --- a/subproc.cc +++ b/subproc.cc @@ -493,7 +493,7 @@ int systemExe(const std::vector& args, char** env) { std::vector argv; for (const auto& a : args) { - argv.push_back(a.c_str()); + argv.push_back(a.c_str()); } argv.push_back(nullptr); diff --git a/user.cc b/user.cc index 5d90704..827a7ec 100644 --- a/user.cc +++ b/user.cc @@ -156,7 +156,7 @@ static bool gidMapSelf(nsjconf_t* nsjconf, pid_t pid) { static bool gidMapExternal(nsjconf_t* nsjconf, pid_t pid UNUSED) { bool use = false; - std::vector argv = { "/usr/bin/newgidmap", std::to_string(pid) }; + std::vector argv = {"/usr/bin/newgidmap", std::to_string(pid)}; for (const auto& gid : nsjconf->gids) { if (!gid.is_newidmap) { continue; @@ -182,7 +182,7 @@ static bool gidMapExternal(nsjconf_t* nsjconf, pid_t pid UNUSED) { static bool uidMapExternal(nsjconf_t* nsjconf, pid_t pid UNUSED) { bool use = false; - std::vector argv = { "/usr/bin/newuidmap", std::to_string(pid) }; + std::vector argv = {"/usr/bin/newuidmap", std::to_string(pid)}; for (const auto& uid : nsjconf->uids) { if (!uid.is_newidmap) { continue;