Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/libbb/run_shell.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/libbb/run_shell.c
r1765 r2725 37 37 static security_context_t current_sid; 38 38 39 void 40 renew_current_security_context(void) 39 void FAST_FUNC renew_current_security_context(void) 41 40 { 42 if (current_sid) 43 freecon(current_sid); /* Release old context */ 41 freecon(current_sid); /* Release old context */ 44 42 getcon(¤t_sid); /* update */ 45 43 } 46 void 47 set_current_security_context(security_context_t sid) 44 void FAST_FUNC set_current_security_context(security_context_t sid) 48 45 { 49 if (current_sid) 50 freecon(current_sid); /* Release old context */ 46 freecon(current_sid); /* Release old context */ 51 47 current_sid = sid; 52 48 } … … 54 50 #endif 55 51 56 /* Run SHELL, or DEFAULT_SHELL if SHELL is empty. 57 If COMMAND is nonzero, pass it to the shell with the -c option. 58 If ADDITIONAL_ARGS is nonzero, pass it to the shell as more 59 arguments. */ 60 61 void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) 52 /* Run SHELL, or DEFAULT_SHELL if SHELL is "" or NULL. 53 * If COMMAND is nonzero, pass it to the shell with the -c option. 54 * If ADDITIONAL_ARGS is nonzero, pass it to the shell as more 55 * arguments. */ 56 void FAST_FUNC run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) 62 57 { 63 58 const char **args; 64 int argno = 1;59 int argno; 65 60 int additional_args_cnt = 0; 66 61 … … 70 65 args = xmalloc(sizeof(char*) * (4 + additional_args_cnt)); 71 66 72 args[0] = bb_get_last_path_component(xstrdup(shell)); 67 if (!shell || !shell[0]) 68 shell = DEFAULT_SHELL; 73 69 70 args[0] = bb_get_last_path_component_nostrip(shell); 74 71 if (loginshell) 75 72 args[0] = xasprintf("-%s", args[0]); 76 73 argno = 1; 77 74 if (command) { 78 75 args[argno++] = "-c"; … … 84 81 } 85 82 args[argno] = NULL; 83 86 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 88 freecon(current_sid); 89 execve(shell, (char **) args, environ);90 } else91 89 #endif 92 90 execv(shell, (char **) args); 93 bb_perror_msg_and_die("can not run %s", shell);91 bb_perror_msg_and_die("can't execute '%s'", shell); 94 92 }
Note:
See TracChangeset
for help on using the changeset viewer.