RFR 9: 8081567 : java/lang/ProcessHandle/InfoTest.java failed Cannot run program "whoami"

Ivan Gerasimov ivan.gerasimov at oracle.com
Wed Jun 3 21:58:33 UTC 2015


Thanks!

------------------
test/java/lang/ProcessHandle/InfoTest.java
------------------
Looks good


------------------
src/java.base/windows/native/libjava/ProcessHandleImpl_win.c
------------------
The changes look good to me!
I guess it does have more sense to use StringSID if the length of user 
name of domain exceeds 256 chars.

>
> Corrections updated in place:
>     http://cr.openjdk.java.net/~rriggs/webrev-whoami-8081567/
>
>> To be extra-safe we could check GetLastError() for ERROR_NONE_MAPPED 
>> and in such rare cases allocate the buffers dynamically.
> I don't see that NONE_MAPPED is associated with the output buffers.
>

Yes, my mistake.  That's output value of domainLen and nameLen that have 
to be analyzed to detect 'buffer is too small' condition.
But I think, what you have is fine.


A couple of minor nits.
I would be just a little bit happier, if it were
  397     WCHAR domain[255 + 1 + 255 + 1];    // large enough to concat 
with '/' and name
  398     WCHAR name[255 *+ 1*];
  399     DWORD domainLen = *sizeof(domain) - sizeof(name)*;

Otherwise, we would never use the last char of 'domain' :-)

You may want to remove the extra space in the signature of procToUser(_ 
), in both the forward declaration and definition.

Sincerely yours,
Ivan




More information about the core-libs-dev mailing list