Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/libbb/change_identity.c

    r2725 r3621  
    3434void FAST_FUNC change_identity(const struct passwd *pw)
    3535{
    36     if (initgroups(pw->pw_name, pw->pw_gid) == -1)
     36    int res;
     37
     38    res = initgroups(pw->pw_name, pw->pw_gid);
     39    endgrent(); /* helps to close a fd used internally by libc */
     40
     41    if (res != 0) {
     42        /*
     43         * If initgroups() fails because a system call is unimplemented
     44         * then we are running on a Linux kernel compiled without multiuser
     45         * support (CONFIG_MULTIUSER is not defined).
     46         *
     47         * If we are running without multiuser support *and* the target uid
     48         * already matches the current uid then we can skip the change of
     49         * identity.
     50         */
     51        if (errno == ENOSYS && pw->pw_uid == getuid()) {
     52            return;
     53        }
     54
    3755        bb_perror_msg_and_die("can't set groups");
    38     endgrent(); /* helps to close a fd used internally by libc */
     56    }
     57
    3958    xsetgid(pw->pw_gid);
    4059    xsetuid(pw->pw_uid);
Note: See TracChangeset for help on using the changeset viewer.