run_shell: code shrink for selinux
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Mon, 10 Sep 2007 17:17:01 +0000 (17:17 +0000)
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Mon, 10 Sep 2007 17:17:01 +0000 (17:17 +0000)
git-svn-id: svn://busybox.net/trunk/busybox@19814 69ca8d6d-28ef-0310-b511-8ec308f3f277

libbb/run_shell.c

index 25d55dd..b2b4216 100644 (file)
@@ -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);