diff src/os/solaris/vm/perfMemory_solaris.cpp @ 17707:7d28f4e15b61

8029775: Solaris code cleanup Summary: cleaned up warnings in solaris specific os code. Reviewed-by: coleenp, fparain, dcubed Contributed-by: gerald.thornbrugh@oracle.com
author dcubed
date Wed, 05 Mar 2014 11:28:33 -0800
parents 1f4355cee9a2
children 4ca6dc0799b6 833b0f92429a d7b6bdd51abe 60a992c821f8
line wrap: on
line diff
--- a/src/os/solaris/vm/perfMemory_solaris.cpp	Fri Jan 24 09:28:47 2014 +0100
+++ b/src/os/solaris/vm/perfMemory_solaris.cpp	Wed Mar 05 11:28:33 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -431,10 +431,12 @@
 
       RESTARTABLE(::read(fd, addr, remaining), result);
       if (result == OS_ERR) {
+        ::close(fd);
         THROW_MSG_0(vmSymbols::java_io_IOException(), "Read error");
+      } else {
+        remaining-=result;
+        addr+=result;
       }
-      remaining-=result;
-      addr+=result;
     }
 
     ::close(fd);
@@ -906,8 +908,16 @@
   FREE_C_HEAP_ARRAY(char, filename, mtInternal);
 
   // open the shared memory file for the give vmid
-  fd = open_sharedmem_file(rfilename, file_flags, CHECK);
-  assert(fd != OS_ERR, "unexpected value");
+  fd = open_sharedmem_file(rfilename, file_flags, THREAD);
+
+  if (fd == OS_ERR) {
+    return;
+  }
+
+  if (HAS_PENDING_EXCEPTION) {
+    ::close(fd);
+    return;
+  }
 
   if (*sizep == 0) {
     size = sharedmem_filesize(fd, CHECK);