diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-12-07 14:11:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:11:17 +0100 |
commit | 411e231995bc07962a7693a9a936fb39f5810ad1 (patch) | |
tree | ac9ad8b47d8bcf95ece21b7e0d7871f460071814 /container-accesslogging | |
parent | c8b8988ee986fa0a08274aa8ef12b7fbddd90488 (diff) |
Revert "Simplify symlink"
Diffstat (limited to 'container-accesslogging')
-rw-r--r-- | container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java b/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java index 75e9febc192..ab246a21a43 100644 --- a/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java +++ b/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java @@ -298,7 +298,14 @@ public class LogFileHandler extends StreamHandler { if (symlinkName == null) return; File f = new File(fileName); File f2 = new File(f.getParent(), symlinkName); - String [] cmd = new String[]{"/bin/ln", "-sf", f.getName(), f2.getPath()}; + String canonicalPath; + try { + canonicalPath = f.getCanonicalPath(); + } catch (IOException e) { + logger.warning("Got '" + e + "' while doing f.getCanonicalPath() on file '" + f.getPath() + "'."); + return; + } + String [] cmd = new String[]{"/bin/ln", "-sf", canonicalPath, f2.getPath()}; try { int retval = new ProcessExecuter().exec(cmd).getFirst(); // Detonator pattern: Think of all the fun we can have if ln isn't what we |