Skip to content

Commit

Permalink
YARN-1519. Check in container-executor if sysconf is implemented befo…
Browse files Browse the repository at this point in the history
…re using it (Radim Kolar and Eric Payne via raviprak)
  • Loading branch information
raviprak committed May 14, 2015
1 parent 09fe16f commit 53fe4ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions hadoop-yarn-project/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@ Release 2.8.0 - UNRELEASED
YARN-2921. Fix MockRM/MockAM#waitForState sleep too long.
(Tsuyoshi Ozawa via wangda)

YARN-1519. Check in container-executor if sysconf is implemented before
using it (Radim Kolar and Eric Payne via raviprak)

Release 2.7.1 - UNRELEASED

INCOMPATIBLE CHANGES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,11 @@ static int create_container_directories(const char* user, const char *app_id,
*/
static struct passwd* get_user_info(const char* user) {
int string_size = sysconf(_SC_GETPW_R_SIZE_MAX);
void* buffer = malloc(string_size + sizeof(struct passwd));
struct passwd *result = NULL;
if(string_size < 1024) {
string_size = 1024;
}
void* buffer = malloc(string_size + sizeof(struct passwd));
if (getpwnam_r(user, buffer, buffer + sizeof(struct passwd), string_size,
&result) != 0) {
free(buffer);
Expand Down Expand Up @@ -1425,7 +1428,7 @@ void chown_dir_contents(const char *dir_path, uid_t uid, gid_t gid) {

dp = opendir(dir_path);
if (dp != NULL) {
while (ep = readdir(dp)) {
while ((ep = readdir(dp)) != NULL) {
stpncpy(buf, ep->d_name, strlen(ep->d_name));
buf[strlen(ep->d_name)] = '\0';
change_owner(path_tmp, uid, gid);
Expand Down Expand Up @@ -1545,4 +1548,4 @@ int traffic_control_read_state(char *command_file) {
*/
int traffic_control_read_stats(char *command_file) {
return run_traffic_control(TC_READ_STATS_OPTS, command_file);
}
}

0 comments on commit 53fe4ef

Please sign in to comment.