From: INSUN PYO Date: Mon, 2 Jul 2018 07:13:08 +0000 (+0900) Subject: Move mount namespace logic from systemd-user-helper code to systemd service file. X-Git-Tag: submit/tizen/20180725.225251^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F92%2F183092%2F1;p=platform%2Fcore%2Fsystem%2Fsession-utils.git Move mount namespace logic from systemd-user-helper code to systemd service file. Signed-off-by: INSUN PYO Change-Id: Ia0fccee5f243a12de5f902641ccb855e6daa7909 --- diff --git a/src/systemd-user-helper/systemd-user-helper.c b/src/systemd-user-helper/systemd-user-helper.c index 60dc3e1..f3686e0 100644 --- a/src/systemd-user-helper/systemd-user-helper.c +++ b/src/systemd-user-helper/systemd-user-helper.c @@ -74,16 +74,6 @@ static const char *systemd_arg[] = { NULL }; -int mac_smack_use(void) -{ - static int cached_use = -1; - - if (cached_use < 0) - cached_use = access("/sys/fs/smackfs/", F_OK) >= 0; - - return cached_use; -} - static int stop_process(char *username) { int r; @@ -100,25 +90,6 @@ static int stop_process(char *username) return 0; } -static int normal_user_preprocess(char *username) -{ - int r; - - r = unshare(CLONE_NEWNS); - if (r < 0) { - fprintf(stderr, "unshare failed\n"); - return r; - } - - r = mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL); - if (r < 0) { - fprintf(stderr, "Failed to change the propagation type of root to SLAVE\n"); - return r; - } - - return 0; -} - static int normal_user_postprocess(char *username) { int r; @@ -321,13 +292,6 @@ int main(int argc, char *argv[]) return -2; } - /* pre-processing */ - r = normal_user_preprocess(username); - if (r < 0) { - fprintf(stderr, "normal user preprocess failed\n"); - return r; - } - /* If container supports below funcs, below line should be enabled. */ support_container = (access(CONTAINER_LIB, F_OK) == 0) ? 1 : 0; if (support_container) { diff --git a/units/session-utils.conf b/units/session-utils.conf index 1abc837..291ef1b 100644 --- a/units/session-utils.conf +++ b/units/session-utils.conf @@ -6,3 +6,5 @@ ExecStart=/usr/bin/systemd-user-helper start %i ExecStop=/usr/bin/systemd-user-helper stop %i PIDFile=/run/user/%i/.systemd.pid + +MountFlags=slave