JDK-6601230 : (attach) Decode system error messages using platform encoding (unix)
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2007-09-05
  • Updated: 2023-12-14
  • Resolved: 2016-11-04
Related Reports
Relates :  
Description
While looking for other occurrences of the bug being fixed by 

6600199: (process) Decode system error messages using platform encoding (unix)

I noticed these uses of strerror

./solaris/native/sun/tools/attach/SolarisVirtualMachine.c:76:		char* msg = strdup(strerror(err));
./solaris/native/sun/tools/attach/SolarisVirtualMachine.c:126:	    char* msg = strdup(strerror(res));
./solaris/native/sun/tools/attach/LinuxVirtualMachine.c:179:		char* msg = strdup(strerror(err));
./solaris/native/sun/tools/attach/LinuxVirtualMachine.c:381:            char* msg = strdup(strerror(res));

that appear to be incorrect.  I suggest replacing 

		char* msg = strdup(strerror(err));
	        JNU_ThrowIOException(env, msg);
		if (msg != NULL) {
		    free(msg);
		}

with a call to JNU_ThrowIOExceptionWithLastError, 
which is simpler and more correct.

Comments
This is not on our list of current priorities. If this changes, please reopen this issue.
04-11-2016

EVALUATION Yes, missed that - the system messages should be used using the platform encoding.
05-09-2007