Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (10 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/libbb/setup_environment.c

    r2725 r3232  
    3333void FAST_FUNC setup_environment(const char *shell, int flags, const struct passwd *pw)
    3434{
     35    if (!shell || !shell[0])
     36        shell = DEFAULT_SHELL;
     37
    3538    /* Change the current working directory to be the home directory
    3639     * of the user */
    37     if (chdir(pw->pw_dir)) {
    38         xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/");
    39         bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir);
     40    if (!(flags & SETUP_ENV_NO_CHDIR)) {
     41        if (chdir(pw->pw_dir) != 0) {
     42            bb_error_msg("can't change directory to '%s'", pw->pw_dir);
     43            xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/");
     44        }
    4045    }
    4146
Note: See TracChangeset for help on using the changeset viewer.