8214300: .attach_pid files may remain in the process cwd
authorgadams
Tue, 04 Dec 2018 07:06:38 -0500
changeset 52817 981eb3c1b90d
parent 52816 03253c32d8e7
child 52818 cfbe4d8ffd1d
8214300: .attach_pid files may remain in the process cwd Reviewed-by: sspitsyn, cjplummer, jcbeyler
src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java
src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java
src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java
--- a/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java	Tue Dec 04 07:09:02 2018 -0500
+++ b/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java	Tue Dec 04 07:06:38 2018 -0500
@@ -268,6 +268,7 @@
         String path = "/proc/" + pid + "/cwd/" + fn;
         File f = new File(path);
         try {
+            f = f.getCanonicalFile();
             f.createNewFile();
         } catch (IOException x) {
             f = new File(tmpdir, fn);
--- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java	Tue Dec 04 07:09:02 2018 -0500
+++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java	Tue Dec 04 07:06:38 2018 -0500
@@ -283,6 +283,7 @@
         String path = "/proc/" + pid + "/cwd/" + fn;
         File f = new File(path);
         try {
+            f = f.getCanonicalFile();
             f.createNewFile();
         } catch (IOException x) {
             String root;
@@ -295,6 +296,7 @@
                 root = tmpdir;
             }
             f = new File(root, fn);
+            f = f.getCanonicalFile();
             f.createNewFile();
         }
         return f;
--- a/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java	Tue Dec 04 07:09:02 2018 -0500
+++ b/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java	Tue Dec 04 07:06:38 2018 -0500
@@ -234,6 +234,7 @@
         String path = "/proc/" + pid + "/cwd/" + fn;
         File f = new File(path);
         try {
+            f = f.getCanonicalFile();
             f.createNewFile();
         } catch (IOException x) {
             f = new File(tmpdir, fn);