Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/libbb/change_identity.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/change_identity.c
r1765 r2725 31 31 #include "libbb.h" 32 32 33 34 33 /* Become the user and group(s) specified by PW. */ 35 const char *change_identity_e2str(const struct passwd *pw)34 void FAST_FUNC change_identity(const struct passwd *pw) 36 35 { 37 36 if (initgroups(pw->pw_name, pw->pw_gid) == -1) 38 return "cannot set groups";39 endgrent(); /* ??*/37 bb_perror_msg_and_die("can't set groups"); 38 endgrent(); /* helps to close a fd used internally by libc */ 40 39 xsetgid(pw->pw_gid); 41 40 xsetuid(pw->pw_uid); 42 return NULL;43 41 } 44 45 void change_identity(const struct passwd *pw)46 {47 const char *err_msg = change_identity_e2str(pw);48 49 if (err_msg)50 bb_perror_msg_and_die("%s", err_msg);51 }
Note:
See TracChangeset
for help on using the changeset viewer.