Skip to content

Commit b7ab377

Browse files
committed
Fix incorrect use of Path.getRoot()
1 parent 74633af commit b7ab377

File tree

1 file changed

+3
-1
lines changed
  • dd-java-agent/agent-profiling/profiling-controller/src/main/java/com/datadog/profiling/controller

1 file changed

+3
-1
lines changed

dd-java-agent/agent-profiling/profiling-controller/src/main/java/com/datadog/profiling/controller/TempLocationManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,9 @@ private void createTempDir(Path tempDir) {
465465
// we will find the first offender not having the expected permissions and fail the check
466466
if (isPosixFs) {
467467
// take the first subfolder below the base temp dir
468-
Path root = baseTempDir.resolve(baseTempDir.relativize(tempDir).getRoot());
468+
// we can wave the checks for tempDir being a subdir of baseTempDir because that's how it is
469+
// created
470+
Path root = baseTempDir.resolve(baseTempDir.relativize(tempDir).getName(0));
469471
try {
470472
AtomicReference<Path> failed = new AtomicReference<>();
471473
Files.walkFileTree(

0 commit comments

Comments
 (0)