--- old/src/solaris/native/java/io/UnixFileSystem_md.c 2013-03-12 15:11:39.252159013 -0700 +++ new/src/solaris/native/java/io/UnixFileSystem_md.c 2013-03-12 15:11:39.120159017 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, 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 @@ -77,7 +77,7 @@ WITH_PLATFORM_STRING(env, pathname, path) { char canonicalPath[JVM_MAXPATHLEN]; - if (canonicalize(JVM_NativePath((char *)path), + if (canonicalize((char *)path, canonicalPath, JVM_MAXPATHLEN) < 0) { JNU_ThrowIOExceptionWithLastError(env, "Bad pathname"); } else { @@ -241,19 +241,18 @@ jboolean rv = JNI_FALSE; WITH_PLATFORM_STRING(env, pathname, path) { - int fd; - if (!strcmp (path, "/")) { - fd = JVM_EEXIST; /* The root directory always exists */ - } else { - fd = JVM_Open(path, JVM_O_RDWR | JVM_O_CREAT | JVM_O_EXCL, 0666); - } - if (fd < 0) { - if (fd != JVM_EEXIST) { - JNU_ThrowIOExceptionWithLastError(env, path); + FD fd; + /* The root directory always exists */ + if (strcmp (path, "/")) { + fd = handleOpen(path, O_RDWR | O_CREAT | O_EXCL, 0666); + if (fd < 0) { + if (errno != EEXIST) + JNU_ThrowIOExceptionWithLastError(env, path); + } else { + if (close(fd) == -1) + JNU_ThrowIOExceptionWithLastError(env, path); + rv = JNI_TRUE; } - } else { - JVM_Close(fd); - rv = JNI_TRUE; } } END_PLATFORM_STRING(env, path); return rv;