summaryrefslogtreecommitdiff
path: root/libbb/run_shell.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-09-10 17:17:01 +0000
committerDenis Vlasenko2007-09-10 17:17:01 +0000
commit976690afe0b376c580dd2756e6d8eafe1317a011 (patch)
tree2351e2a62c1af582ceedf1c0e67d2210d2fc0d61 /libbb/run_shell.c
parenta2f61012b6f93473ed002e6609557cb1cd81b7dd (diff)
downloadbusybox-976690afe0b376c580dd2756e6d8eafe1317a011.zip
busybox-976690afe0b376c580dd2756e6d8eafe1317a011.tar.gz
run_shell: code shrink for selinux
Diffstat (limited to 'libbb/run_shell.c')
-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 25d55dd..b2b4216 100644
--- a/libbb/run_shell.c
+++ b/libbb/run_shell.c
@@ -39,15 +39,13 @@ static security_context_t current_sid;
void
renew_current_security_context(void)
{
- if (current_sid)
- freecon(current_sid); /* Release old context */
+ freecon(current_sid); /* Release old context */
getcon(&current_sid); /* update */
}
void
set_current_security_context(security_context_t sid)
{
- if (current_sid)
- freecon(current_sid); /* Release old context */
+ freecon(current_sid); /* Release old context */
current_sid = sid;
}
@@ -84,10 +82,10 @@ void run_shell(const char *shell, int loginshell, const char *command, const cha
}
args[argno] = NULL;
#if ENABLE_SELINUX
- if (current_sid && !setexeccon(current_sid)) {
+ if (current_sid)
+ setexeccon(current_sid);
+ if (ENABLE_FEATURE_CLEAN_UP)
freecon(current_sid);
- execve(shell, (char **) args, environ);
- } else
#endif
execv(shell, (char **) args);
bb_perror_msg_and_die("cannot run %s", shell);