Author: eli Date: Sun Nov 20 21:09:31 2011 New Revision: 1204266 URL: http://svn.apache.org/viewvc?rev=1204266&view=rev Log: MAPREDUCE-2377. task-controller fails to parse configuration if it doesn't end in \n. Contributed by Todd Lipcon
Modified: hadoop/common/branches/branch-0.20-security/CHANGES.txt hadoop/common/branches/branch-0.20-security/src/c++/task-controller/impl/configuration.c hadoop/common/branches/branch-0.20-security/src/c++/task-controller/test/test-task-controller.c Modified: hadoop/common/branches/branch-0.20-security/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/CHANGES.txt?rev=1204266&r1=1204265&r2=1204266&view=diff ============================================================================== --- hadoop/common/branches/branch-0.20-security/CHANGES.txt (original) +++ hadoop/common/branches/branch-0.20-security/CHANGES.txt Sun Nov 20 21:09:31 2011 @@ -43,6 +43,9 @@ Release 0.20.206.0 - unreleased HDFS-2541. For a sufficiently large value of blocks, the DN Scanner may request a random number with a negative seed value. (harsh via eli) + MAPREDUCE-2377. task-controller fails to parse configuration if it + doesn't end in \n. (todd via eli) + IMPROVEMENTS MAPREDUCE-2836. Provide option to fail jobs when submitted to Modified: hadoop/common/branches/branch-0.20-security/src/c++/task-controller/impl/configuration.c URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/src/c%2B%2B/task-controller/impl/configuration.c?rev=1204266&r1=1204265&r2=1204266&view=diff ============================================================================== --- hadoop/common/branches/branch-0.20-security/src/c++/task-controller/impl/configuration.c (original) +++ hadoop/common/branches/branch-0.20-security/src/c++/task-controller/impl/configuration.c Sun Nov 20 21:09:31 2011 @@ -155,8 +155,12 @@ void read_config(const char* file_name) break; } } - //trim the ending new line - line[strlen(line)-1] = '\0'; + + //trim the ending new line if there is one + if (line[strlen(line) - 1] == '\n') { + line[strlen(line)-1] = '\0'; + } + //comment line if(line[0] == '#') { free(line); Modified: hadoop/common/branches/branch-0.20-security/src/c++/task-controller/test/test-task-controller.c URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/src/c%2B%2B/task-controller/test/test-task-controller.c?rev=1204266&r1=1204265&r2=1204266&view=diff ============================================================================== --- hadoop/common/branches/branch-0.20-security/src/c++/task-controller/test/test-task-controller.c (original) +++ hadoop/common/branches/branch-0.20-security/src/c++/task-controller/test/test-task-controller.c Sun Nov 20 21:09:31 2011 @@ -97,7 +97,7 @@ int write_config_file(char *file_name) { fprintf(file, "," TEST_ROOT "/local-%d", i); } fprintf(file, "\n"); - fprintf(file, "hadoop.log.dir=" TEST_ROOT "/logs\n"); + fprintf(file, "hadoop.log.dir=" TEST_ROOT "/logs"); fclose(file); return 0; }