Skip to content

Commit aabf699

Browse files
author
Brian Burkhalter
committed
8355339: Test java/io/File/GetCanonicalPath.java failed: The specified network name is no longer available
Reviewed-by: alanb
1 parent 9d71af1 commit aabf699

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/java.base/windows/native/libjava/canonicalize_md.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
4141
/* We should also include jdk_util.h here, for the prototype of JDK_Canonicalize.
4242
This isn't possible though because canonicalize_md.c is as well used in
4343
different contexts within Oracle.
44-
*/
44+
*/
4545
#include "io_util_md.h"
4646

4747
/* Copy bytes to dst, not going past dend; return dst + number of bytes copied,
@@ -139,7 +139,8 @@ lastErrorReportable()
139139
|| (errval == ERROR_ACCESS_DENIED)
140140
|| (errval == ERROR_NETWORK_UNREACHABLE)
141141
|| (errval == ERROR_NETWORK_ACCESS_DENIED)
142-
|| (errval == ERROR_NO_MORE_FILES)) {
142+
|| (errval == ERROR_NO_MORE_FILES)
143+
|| (errval == ERROR_NETNAME_DELETED)) {
143144
return 0;
144145
}
145146
return 1;
@@ -183,7 +184,7 @@ wcanonicalize(WCHAR *orig_path, WCHAR *result, int size)
183184
/* Copy prefix, assuming path is absolute */
184185
c = src[0];
185186
if (((c <= L'z' && c >= L'a') || (c <= L'Z' && c >= L'A'))
186-
&& (src[1] == L':') && (src[2] == L'\\')) {
187+
&& (src[1] == L':') && (src[2] == L'\\')) {
187188
/* Drive specifier */
188189
*src = towupper(*src); /* Canonicalize drive letter */
189190
if (!(dst = wcp(dst, dend, L'\0', src, src + 2))) {
@@ -244,9 +245,9 @@ wcanonicalize(WCHAR *orig_path, WCHAR *result, int size)
244245
continue;
245246
} else {
246247
if (!lastErrorReportable()) {
247-
if (!(dst = wcp(dst, dend, L'\0', src, src + wcslen(src)))){
248-
goto err;
249-
}
248+
if (!(dst = wcp(dst, dend, L'\0', src, src + wcslen(src)))){
249+
goto err;
250+
}
250251
break;
251252
} else {
252253
goto err;
@@ -255,7 +256,7 @@ wcanonicalize(WCHAR *orig_path, WCHAR *result, int size)
255256
}
256257

257258
if (dst >= dend) {
258-
errno = ENAMETOOLONG;
259+
errno = ENAMETOOLONG;
259260
goto err;
260261
}
261262
*dst = L'\0';
@@ -366,7 +367,7 @@ JDK_Canonicalize(const char *orig, char *out, int len) {
366367
// Change return value to success.
367368
ret = 0;
368369

369-
finish:
370+
finish:
370371
free(wresult);
371372
free(wpath);
372373

0 commit comments

Comments
 (0)