changeset 4106:9081b871b6cf jdk6-b38

8075773: jps running as root fails after the fix of JDK-8050807 Reviewed-by: sla, dsamersoff, gthornbr Contributed-by: cheleswer.sahu@oracle.com
author kevinw
date Thu, 06 Aug 2015 00:08:57 -0700
parents 9732f3600a48
children a770f5694856
files src/os/linux/vm/perfMemory_linux.cpp src/os/solaris/vm/perfMemory_solaris.cpp
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/linux/vm/perfMemory_linux.cpp	Fri Nov 13 01:28:36 2015 +0000
+++ b/src/os/linux/vm/perfMemory_linux.cpp	Thu Aug 06 00:08:57 2015 -0700
@@ -216,9 +216,9 @@
     //
     return false;
   }
-  // See if the uid of the directory matches the effective uid of the process.
-  //
-  if (statp->st_uid != geteuid()) {
+  // If user is not root then see if the uid of the directory matches the effective uid of the process.
+  uid_t euid = geteuid();
+  if ((euid != 0) && (statp->st_uid != euid)) {
     // The directory was not created by this user, declare it insecure.
     //
     return false;
--- a/src/os/solaris/vm/perfMemory_solaris.cpp	Fri Nov 13 01:28:36 2015 +0000
+++ b/src/os/solaris/vm/perfMemory_solaris.cpp	Thu Aug 06 00:08:57 2015 -0700
@@ -218,9 +218,9 @@
     //
     return false;
   }
-  // See if the uid of the directory matches the effective uid of the process.
-  //
-  if (statp->st_uid != geteuid()) {
+  // If user is not root then see if the uid of the directory matches the effective uid of the process.
+  uid_t euid = geteuid();
+  if ((euid != 0) && (statp->st_uid != euid)) {
     // The directory was not created by this user, declare it insecure.
     //
     return false;