Author: ddas Date: Fri Mar 16 22:38:44 2012 New Revision: 1301804 URL: http://svn.apache.org/viewvc?rev=1301804&view=rev Log: Fixing an issue to do with setting of correct groups for tasks
Modified: hadoop/common/branches/branch-1/src/c++/task-controller/impl/task-controller.c Modified: hadoop/common/branches/branch-1/src/c++/task-controller/impl/task-controller.c URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/c%2B%2B/task-controller/impl/task-controller.c?rev=1301804&r1=1301803&r2=1301804&view=diff ============================================================================== --- hadoop/common/branches/branch-1/src/c++/task-controller/impl/task-controller.c (original) +++ hadoop/common/branches/branch-1/src/c++/task-controller/impl/task-controller.c Fri Mar 16 22:38:44 2012 @@ -590,6 +590,17 @@ int set_user(const char *user) { if (user_detail == NULL) { return -1; } + + if (geteuid() == user_detail->pw_uid) { + return 0; + } + + if (initgroups(user, user_detail->pw_gid) != 0) { + fprintf(LOGFILE, "Error setting supplementary groups for user %s: %s\n", + user, strerror(errno)); + return -1; + } + return change_effective_user(user_detail->pw_uid, user_detail->pw_gid); }