From: Robert Swiecki Date: Mon, 18 Mar 2019 15:37:04 +0000 (+0100) Subject: mnt: use /run/usr/ first when mounting dirs X-Git-Tag: 2.9~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9fe225dbe2e3c30ee9ee83c8a51dae9ab9b941fd;p=platform%2Fupstream%2Fnsjail.git mnt: use /run/usr/ first when mounting dirs --- diff --git a/config.proto b/config.proto index 8366704..90091be 100644 --- a/config.proto +++ b/config.proto @@ -4,14 +4,14 @@ package nsjail; enum Mode { LISTEN = 0; /* Listening on a TCP port */ - ONCE = 1; /* Running the command once only */ - RERUN = 2; /* Re-executing the command (forever) */ + ONCE = 1; /* Running the command once only */ + RERUN = 2; /* Re-executing the command (forever) */ EXECVE = 3; /* Executing command w/o the supervisor */ } /* Should be self explanatory */ enum LogLevel { - DEBUG = 0; /* Equivalent to the '-v' cmd-line option */ - INFO = 1; /* Default level */ + DEBUG = 0; /* Equivalent to the '-v' cmd-line option */ + INFO = 1; /* Default level */ WARNING = 2; /* Equivalent to the '-q' cmd-line option */ ERROR = 3; FATAL = 4; diff --git a/mnt.cc b/mnt.cc index f6aa412..81b7eac 100644 --- a/mnt.cc +++ b/mnt.cc @@ -282,6 +282,15 @@ static bool mkdirAndTest(const std::string& dir) { static std::unique_ptr getDir(nsjconf_t* nsjconf, const char* name) { std::unique_ptr dir(new std::string); + dir->assign("/run/user/") + .append(std::to_string(nsjconf->orig_uid)) + .append("/nsjail.") + .append(std::to_string(nsjconf->orig_uid)) + .append(".") + .append(name); + if (mkdirAndTest(*dir)) { + return dir; + } dir->assign("/run/user/") .append("/nsjail.") .append(std::to_string(nsjconf->orig_uid))