Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6601230

(attach) Decode system error messages using platform encoding (unix)

XMLWordPrintable

    • generic
    • generic

      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.

            Unassigned Unassigned
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: