mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8259637: java.io.File.getCanonicalPath() returns different values for same path
Reviewed-by: alanb
This commit is contained in:
parent
4f3de09672
commit
b98d13fc3c
2 changed files with 36 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -157,7 +157,13 @@ collapse(char *path)
|
|||
for (j = i - 1; j >= 0; j--) {
|
||||
if (ix[j]) break;
|
||||
}
|
||||
if (j < 0) continue;
|
||||
if (j < 0) {
|
||||
// If there is no preceding name and this path is absolute,
|
||||
// then remove this instance of ".."
|
||||
if (path[0] == '/')
|
||||
ix[i] = 0;
|
||||
continue;
|
||||
}
|
||||
ix[j] = 0;
|
||||
ix[i] = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue