On 11/07/2018 03:33, Ivan Gerasimov wrote:
Hello!

File src/java.base/windows/native/libjava/WinNTFileSystem_md.c
The function getFinalPath() is wrapper for GetFinalPathNameByHandleW(), which is used to resolve the symlinks on Windows.

If the resulting string begins with a prefix "\\?\" or "\\?\UNC", a copy without the prefix is created and returned.

Instead of creating the copy, we can override the result with memmove() to avoid allocating extra native memory. The result of getFinalPath() is short living anyway, so a few unused bytes at the end of the buffer should not be a problem.

The advantage is a shorter code and minus one point of possible failure.

Would you please help review it?

BUG: https://bugs.openjdk.java.net/browse/JDK-8207016
Webrev: http://cr.openjdk.java.net/~igerasim/8207016/00/webrev/
I think this looks okay.

-Alan

Reply via email to