IOException from sun.nio.fs.UnixUserPrincipals.lookupName
Neil Richards
neil.richards at ngmr.net
Thu Nov 24 04:19:46 PST 2011
On Wed, 2011-11-23 at 13:46 +0000, Neil Richards wrote:
> On Wed, 2011-11-23 at 12:26 +0000, Alan Bateman wrote:
> > On 21/11/2011 09:50, Jonathan Lu wrote:
> > > Yes, this problem was originally found on AIX platform and I just
> > > tested getgrnam_r(), it failed with the same errno as getpwnam_r(),
> > > so I think if there's an adjustment, getgrnam0 should be included
> > > too.
> > As I said, I don't see a problem extending the check to include ESRCH.
> > It's one of these holes in the standards. Will you send the patch for
> > both calls so that we can review it? Also is Neil going to push it or
> > do you need me to do it? I've created a bug for it:
> >
> > 7115070: (fs) lookupPrincipalByName/lookupPrincipalByGroupName should
> > treat ESRCH as not found
> >
> > -Alan.
>
> Hi all,
> I'm happy to push it once Jonathan's suggested change is agreed (once
> he's posted the patch).
>
> Regards, Neil
>
Jonathan's having some fun getting to his mail server this morning, so
has slipped his suggested change into my digital hands (by other means).
So, on his behalf, please find his change below in 'hg export' form.
I've also posted this as a webrev, for ease of review [1].
Regards, Neil
[1] http://cr.openjdk.java.net/~ngmr/7115070/webrev.00/
--
Unless stated above:
IBM email: neil_richards at uk.ibm.com
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
# HG changeset patch
# User ngmr
# Date 1322134471 0
# Node ID 4a69082ac5d9a7dc0ca66282ec79e0df76c9fdb8
# Parent 99632935785e2038b2fc836da9f2ede69dea294b
7115070: (fs) lookupPrincipalByName/lookupPrincipalByGroupName should treat ESRCH as not found
Reviewed-by: alanb
Contributed-by: Jonathan Lu <luchsh at linux.vnet.ibm.com>
diff --git a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c b/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
--- a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
+++ b/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
@@ -996,7 +996,7 @@
if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
/* not found or error */
- if (errno != 0 && errno != ENOENT)
+ if (errno != 0 && errno != ENOENT && errno != ESRCH)
throwUnixException(env, errno);
} else {
uid = p->pw_uid;
@@ -1042,7 +1042,7 @@
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 != 0 && errno != ENOENT && errno != ESRCH) {
if (errno == ERANGE) {
/* insufficient buffer size so need larger buffer */
buflen += ENT_BUF_SIZE;
More information about the nio-dev
mailing list