changeset 3527:0813fa17749b

. Ownership of the temporary java_pid.XXXX file is checked before attachment can proceed. Since /tmp is normally a sticky directory (see sticky(8)), the group ownership of files created there don't usually match the user's group. So chown the temporary file to the user's user and group before the attachment occurs. This fixes jstack on *BSD.
author Greg Lewis <glewis@eyesbeyond.com>
date Sat, 04 Aug 2012 10:30:57 -0700
parents 134b99f13cc9
children aca25e0c3da5
files src/os/bsd/vm/attachListener_bsd.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/bsd/vm/attachListener_bsd.cpp	Tue Jul 31 23:08:31 2012 -0700
+++ b/src/os/bsd/vm/attachListener_bsd.cpp	Sat Aug 04 10:30:57 2012 -0700
@@ -208,7 +208,10 @@
   if (res == 0) {
       RESTARTABLE(::chmod(initial_path, S_IREAD|S_IWRITE), res);
       if (res == 0) {
-          res = ::rename(initial_path, path);
+          RESTARTABLE(::chown(initial_path, geteuid(), getegid()), res);
+          if (res == 0) {
+              res = ::rename(initial_path, path);
+          }
       }
   }
   if (res == -1) {