aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-09-10 17:17:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-09-10 17:17:01 +0000
commit976690afe0b376c580dd2756e6d8eafe1317a011 (patch)
tree2351e2a62c1af582ceedf1c0e67d2210d2fc0d61
parenta2f61012b6f93473ed002e6609557cb1cd81b7dd (diff)
downloadbusybox-w32-976690afe0b376c580dd2756e6d8eafe1317a011.tar.gz
busybox-w32-976690afe0b376c580dd2756e6d8eafe1317a011.tar.bz2
busybox-w32-976690afe0b376c580dd2756e6d8eafe1317a011.zip
run_shell: code shrink for selinux
-rw-r--r--libbb/run_shell.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libbb/run_shell.c b/libbb/run_shell.c
index 25d55dd63..b2b4216f4 100644
--- a/libbb/run_shell.c
+++ b/libbb/run_shell.c
@@ -39,15 +39,13 @@ static security_context_t current_sid;
39void 39void
40renew_current_security_context(void) 40renew_current_security_context(void)
41{ 41{
42 if (current_sid) 42 freecon(current_sid); /* Release old context */
43 freecon(current_sid); /* Release old context */
44 getcon(&current_sid); /* update */ 43 getcon(&current_sid); /* update */
45} 44}
46void 45void
47set_current_security_context(security_context_t sid) 46set_current_security_context(security_context_t sid)
48{ 47{
49 if (current_sid) 48 freecon(current_sid); /* Release old context */
50 freecon(current_sid); /* Release old context */
51 current_sid = sid; 49 current_sid = sid;
52} 50}
53 51
@@ -84,10 +82,10 @@ void run_shell(const char *shell, int loginshell, const char *command, const cha
84 } 82 }
85 args[argno] = NULL; 83 args[argno] = NULL;
86#if ENABLE_SELINUX 84#if ENABLE_SELINUX
87 if (current_sid && !setexeccon(current_sid)) { 85 if (current_sid)
86 setexeccon(current_sid);
87 if (ENABLE_FEATURE_CLEAN_UP)
88 freecon(current_sid); 88 freecon(current_sid);
89 execve(shell, (char **) args, environ);
90 } else
91#endif 89#endif
92 execv(shell, (char **) args); 90 execv(shell, (char **) args);
93 bb_perror_msg_and_die("cannot run %s", shell); 91 bb_perror_msg_and_die("cannot run %s", shell);