Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/libbb/run_shell.c

    r1765 r2725  
    3737static security_context_t current_sid;
    3838
    39 void
    40 renew_current_security_context(void)
     39void FAST_FUNC renew_current_security_context(void)
    4140{
    42     if (current_sid)
    43         freecon(current_sid);  /* Release old context  */
     41    freecon(current_sid);  /* Release old context  */
    4442    getcon(&current_sid);  /* update */
    4543}
    46 void
    47 set_current_security_context(security_context_t sid)
     44void FAST_FUNC set_current_security_context(security_context_t sid)
    4845{
    49     if (current_sid)
    50         freecon(current_sid);  /* Release old context  */
     46    freecon(current_sid);  /* Release old context  */
    5147    current_sid = sid;
    5248}
     
    5450#endif
    5551
    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.  */
     56void FAST_FUNC run_shell(const char *shell, int loginshell, const char *command, const char **additional_args)
    6257{
    6358    const char **args;
    64     int argno = 1;
     59    int argno;
    6560    int additional_args_cnt = 0;
    6661
     
    7065    args = xmalloc(sizeof(char*) * (4 + additional_args_cnt));
    7166
    72     args[0] = bb_get_last_path_component(xstrdup(shell));
     67    if (!shell || !shell[0])
     68        shell = DEFAULT_SHELL;
    7369
     70    args[0] = bb_get_last_path_component_nostrip(shell);
    7471    if (loginshell)
    7572        args[0] = xasprintf("-%s", args[0]);
    76 
     73    argno = 1;
    7774    if (command) {
    7875        args[argno++] = "-c";
     
    8481    }
    8582    args[argno] = NULL;
     83
    8684#if ENABLE_SELINUX
    87     if (current_sid && !setexeccon(current_sid)) {
     85    if (current_sid)
     86        setexeccon(current_sid);
     87    if (ENABLE_FEATURE_CLEAN_UP)
    8888        freecon(current_sid);
    89         execve(shell, (char **) args, environ);
    90     } else
    9189#endif
    9290    execv(shell, (char **) args);
    93     bb_perror_msg_and_die("cannot run %s", shell);
     91    bb_perror_msg_and_die("can't execute '%s'", shell);
    9492}
Note: See TracChangeset for help on using the changeset viewer.