mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8253572: [windows] CDS archive may fail to open with long file names
8249943: [TESTBUG] runtime/cds/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java Reviewed-by: ccheung, iklam
This commit is contained in:
parent
4167540074
commit
b66fa8f444
1 changed files with 12 additions and 2 deletions
|
@ -4827,15 +4827,25 @@ static int stdinAvailable(int fd, long *pbytes) {
|
||||||
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
|
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
|
||||||
char *addr, size_t bytes, bool read_only,
|
char *addr, size_t bytes, bool read_only,
|
||||||
bool allow_exec) {
|
bool allow_exec) {
|
||||||
|
|
||||||
|
errno_t err;
|
||||||
|
wchar_t* wide_path = wide_abs_unc_path(file_name, err);
|
||||||
|
|
||||||
|
if (wide_path == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
char* base;
|
char* base;
|
||||||
|
|
||||||
hFile = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ, NULL,
|
hFile = CreateFileW(wide_path, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (hFile == INVALID_HANDLE_VALUE) {
|
if (hFile == INVALID_HANDLE_VALUE) {
|
||||||
log_info(os)("CreateFile() failed: GetLastError->%ld.", GetLastError());
|
log_info(os)("CreateFileW() failed: GetLastError->%ld.", GetLastError());
|
||||||
|
os::free(wide_path);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
os::free(wide_path);
|
||||||
|
|
||||||
if (allow_exec) {
|
if (allow_exec) {
|
||||||
// CreateFileMapping/MapViewOfFileEx can't map executable memory
|
// CreateFileMapping/MapViewOfFileEx can't map executable memory
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue