ASF Header to all files have been included.
A new enum which returns errors codes based on what is defined in enums.
Now executable accepts
l file name or -log=File name as input to logfile. Log file is opened in append mode with permissions of rwxrw-rw. If no log file is provided then defaults to stderr. All print statement now points to the log file.
Removed redundant check in get_user_details.
Function signatures have been changed to accept job id, task id and tt_root directly instead of passing an array all of the arguments are derived from argv.
Malloc's reduced and wherever it is used an extra byte is allocated for '\0' and all strings forcibly terminated with '\0'.
Number of dynamic memory allocation :
get_configs - Allocating for configuration file name, contents of the file and configuration details which is right now dynamically re sized. free of contents and file name done in same function, whereas freeing up of configuration done in run_task_as_user and kill_user_task.
get_pid_path - pid_path is malloced (freed in run_task_as_user, kill_user_task).
get_task_script_path : task-script-path malloced but not freed, leaking this string.
All syscalls i.e like fopen, malloc are checked for return codes. Strtok and strncat are checked for successful completion.
config parsing fails if the file is of not the right format, the executable fails, cleaning up all memory allocated with the same. Configuration file now supports a comment line by # in begining of line, but # in middle of a line is taken as the value of the line.
Number of numeric literals :
get_configs : 1. for number of bytes to read into contents (const int within the method).
2. for number of config items max_size (const int with in the function).
pid_file generated is now world readable and writable.
Check tt_root now uses strcmp instead of strncmp.
get_task_file_path is now allocating correct number of memory.
all print statements go to LOGFILE.
All cleaning up done before launching JVM except a string which is used for task_script_path.
hadoop_temp_dir contains a comma sperated list of tt_roots, I have used char * as storage, do u want me to change it to char **?