Correctly detect symlinked log directory on startup
On startup the FileUtil.mkdirsOrDie() method uses the Files.createDirectories() method to detect if the '$site_path/logs' directory exists and create it if not. This method fails if the '$site_path/logs' is a symlink to another directory and prevents the server from starting. Add a call to Files.isDirectory() first to correctly detect this scenario and allow the server to start. Bug: Issue 3733 Change-Id: I0f7e2c94086641178c1772a404baa87f3bd7deb2
This commit is contained in:
@@ -88,7 +88,9 @@ public class FileUtil {
|
|||||||
|
|
||||||
public static Path mkdirsOrDie(Path p, String errMsg) {
|
public static Path mkdirsOrDie(Path p, String errMsg) {
|
||||||
try {
|
try {
|
||||||
|
if (!Files.isDirectory(p)) {
|
||||||
Files.createDirectories(p);
|
Files.createDirectories(p);
|
||||||
|
}
|
||||||
return p;
|
return p;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new Die(errMsg + ": " + p, e);
|
throw new Die(errMsg + ": " + p, e);
|
||||||
|
Reference in New Issue
Block a user