changeset 52974:981eb3c1b90d

8214300: .attach_pid files may remain in the process cwd Reviewed-by: sspitsyn, cjplummer, jcbeyler
author gadams
date Tue, 04 Dec 2018 07:06:38 -0500
parents 03253c32d8e7
children cfbe4d8ffd1d
files 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
diffstat 3 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);