code review for attach on demand (AOD) fix for Windows (7028668)

Kelly O'Hair kelly.ohair at oracle.com
Thu Mar 17 13:29:48 PDT 2011


Dan,

It looks ok, but you are using sprintf, and it really should be snprintf.
On Windows you may need to:
   #define snprintf        _snprintf

---
We (myself included) all need to start being more careful about use of strcpy, strcat, sprintf, etc.
The static analysis tools are all starting to just flag the use of them as an error, so we need to start
getting rid of these calls from all our code eventually. Which may take some major time. :^(
Don't shoot the messenger. :^(

-kto

On Mar 17, 2011, at 11:42 AM, Daniel D. Daugherty wrote:

> Greetings,
> 
> I have minor fixes to the Attach On Demand (AOD) Windows
> specific code that I'd like to get into T&L snapshot for
> OpenJDK7-B136 (next week):
> 
>   http://cr.openjdk.java.net/~dcubed/7028668-webrev/0/
> 
> I'm adding more info to the default detail message for an
> OpenProcess() failure. I'm also getting a process handle
> in a different way when a Java process tries to attach to
> itself. If the new technique fails, then we fall back to
> the original OpenProcess() code.
> 
> Thanks, in advance, for any comments.
> 
> Dan
> 
> 
> 



More information about the serviceability-dev mailing list