You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 04:26:07 UTC

svn commit: r1076960 - in /hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller: task-controller.c task-controller.h

Author: omalley
Date: Fri Mar  4 03:26:07 2011
New Revision: 1076960

URL: http://svn.apache.org/viewvc?rev=1076960&view=rev
Log:
commit 720b051217e4b9a12e6334a90cb9fd8fe6ce1e36
Author: Lee Tucker <lt...@yahoo-inc.com>
Date:   Thu Jul 30 17:40:47 2009 -0700

    Applying patch 2886449.5420.patch

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.c
    hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.h

Modified: hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.c
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/c%2B%2B/task-controller/task-controller.c?rev=1076960&r1=1076959&r2=1076960&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.c (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.c Fri Mar  4 03:26:07 2011
@@ -326,6 +326,20 @@ int run_task_as_user(const char * user, 
     }
     goto cleanup;
   }
+
+  if(chown(pid_path, uid, getgid()) < 0) {
+    fprintf(LOGFILE, "Error changing ownershipt of %s task-pid file : %s\n",
+      pid_path, strerror(errno));
+    errno = 0;
+    if (remove(pid_path) < 0) {
+      fprintf(LOGFILE, "Error deleting %s task-pid file : %s", pid_path,
+          strerror(errno));
+      exit_code = UNABLE_TO_CHANGE_OWNERSHIP_AND_DELETE_PID_FILE;
+    } else {
+      exit_code = UNABLE_TO_CHANGE_OWNERSHIP_OF_PID_FILE;
+    }
+    goto cleanup;
+  }
   //while checking path make sure the target of the path exists otherwise
   //check_paths would fail always. So write out .pid file then check if
   //it correctly resolves. If not delete the pid file and bail out.

Modified: hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.h
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/c%2B%2B/task-controller/task-controller.h?rev=1076960&r1=1076959&r2=1076960&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.h (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.h Fri Mar  4 03:26:07 2011
@@ -61,7 +61,9 @@ enum errorcodes {
   ERROR_RESOLVING_FILE_PATH,
   RELATIVE_PATH_COMPONENTS_IN_FILE_PATH,
   UNABLE_TO_STAT_FILE,
-  FILE_NOT_OWNED_BY_TASKTRACKER
+  FILE_NOT_OWNED_BY_TASKTRACKER,
+  UNABLE_TO_CHANGE_OWNERSHIP_OF_PID_FILE,
+  UNABLE_TO_CHANGE_OWNERSHIP_AND_DELETE_PID_FILE
 };