jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
changeset 9688 2ef6a91ab99f
parent 9035 1255eb81cc2f
child 11109 f93eafffdf23
--- a/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Wed May 11 14:57:17 2011 +0100
+++ b/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Wed May 11 15:00:16 2011 +0100
@@ -892,8 +892,9 @@
 
         if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
             /* not found or error */
-            if (errno != 0 && errno != ENOENT)
-                throwUnixException(env, errno);
+            if (errno == 0)
+                errno = ENOENT;
+            throwUnixException(env, errno);
         } else {
             jsize len = strlen(p->pw_name);
             result = (*env)->NewByteArray(env, len);
@@ -941,14 +942,14 @@
         retry = 0;
         if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
             /* not found or error */
-            if (errno != 0 && errno != ENOENT) {
-                if (errno == ERANGE) {
-                    /* insufficient buffer size so need larger buffer */
-                    buflen += ENT_BUF_SIZE;
-                    retry = 1;
-                } else {
-                    throwUnixException(env, errno);
-                }
+            if (errno == ERANGE) {
+                /* insufficient buffer size so need larger buffer */
+                buflen += ENT_BUF_SIZE;
+                retry = 1;
+            } else {
+                if (errno == 0)
+                    errno = ENOENT;
+                throwUnixException(env, errno);
             }
         } else {
             jsize len = strlen(g->gr_name);