8214300: .attach_pid files may remain in the process cwd

Reviewed-by: sspitsyn, cjplummer, jcbeyler
This commit is contained in:
Gary Adams 2018-12-04 07:06:38 -05:00
parent b4630d6207
commit ec1f026392
3 changed files with 4 additions and 0 deletions

View File

@ -268,6 +268,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine {
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);

View File

@ -283,6 +283,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine {
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 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine {
root = tmpdir;
}
f = new File(root, fn);
f = f.getCanonicalFile();
f.createNewFile();
}
return f;

View File

@ -234,6 +234,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine {
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);