Author: shv
Date: Tue Jun 5 06:14:43 2012
New Revision: 1346251
URL: http://svn.apache.org/viewvc?rev=1346251&view=rev
Log:
MAPREDUCE-2377. task-controller fails to parse configuration if it doesn't end in \n. Contributed
by Todd Lipcon and Benoy Antony.
Modified:
hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt
hadoop/common/branches/branch-0.22/mapreduce/src/c++/task-controller/impl/configuration.c
hadoop/common/branches/branch-0.22/mapreduce/src/c++/task-controller/test/test-task-controller.c
Modified: hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt?rev=1346251&r1=1346250&r2=1346251&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.22/mapreduce/CHANGES.txt Tue Jun 5 06:14:43 2012
@@ -53,6 +53,9 @@ Release 0.22.1 - Unreleased
MAPREDUCE-2353. MR changes to reflect the API changes in SecureIO library.
(Devaraj Das and Benoy Antony via shv)
+ MAPREDUCE-2377. task-controller fails to parse configuration if it doesn't
+ end in \n. (Todd Lipcon and Benoy Antony via shv)
+
Release 0.22.0 - 2011-11-29
INCOMPATIBLE CHANGES
Modified: hadoop/common/branches/branch-0.22/mapreduce/src/c++/task-controller/impl/configuration.c
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/src/c%2B%2B/task-controller/impl/configuration.c?rev=1346251&r1=1346250&r2=1346251&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/src/c++/task-controller/impl/configuration.c
(original)
+++ hadoop/common/branches/branch-0.22/mapreduce/src/c++/task-controller/impl/configuration.c
Tue Jun 5 06:14:43 2012
@@ -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.22/mapreduce/src/c++/task-controller/test/test-task-controller.c
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/mapreduce/src/c%2B%2B/task-controller/test/test-task-controller.c?rev=1346251&r1=1346250&r2=1346251&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/mapreduce/src/c++/task-controller/test/test-task-controller.c
(original)
+++ hadoop/common/branches/branch-0.22/mapreduce/src/c++/task-controller/test/test-task-controller.c
Tue Jun 5 06:14:43 2012
@@ -95,7 +95,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;
}
|