src/hotspot/os/posix/os_posix.cpp
changeset 53882 ca682d9d8db5
parent 53654 7054249afee5
child 53886 e94ed0236046
equal deleted inserted replaced
53881:db24a4cb8139 53882:ca682d9d8db5
   178 
   178 
   179 int os::create_file_for_heap(const char* dir) {
   179 int os::create_file_for_heap(const char* dir) {
   180 
   180 
   181   const char name_template[] = "/jvmheap.XXXXXX";
   181   const char name_template[] = "/jvmheap.XXXXXX";
   182 
   182 
   183   char *fullname = (char*)os::malloc((strlen(dir) + strlen(name_template) + 1), mtInternal);
   183   size_t fullname_len = strlen(dir) + strlen(name_template);
       
   184   char *fullname = (char*)os::malloc(fullname_len + 1, mtInternal);
   184   if (fullname == NULL) {
   185   if (fullname == NULL) {
   185     vm_exit_during_initialization(err_msg("Malloc failed during creation of backing file for heap (%s)", os::strerror(errno)));
   186     vm_exit_during_initialization(err_msg("Malloc failed during creation of backing file for heap (%s)", os::strerror(errno)));
   186     return -1;
   187     return -1;
   187   }
   188   }
   188   (void)strncpy(fullname, dir, strlen(dir)+1);
   189   int n = snprintf(fullname, fullname_len + 1, "%s%s", dir, name_template);
   189   (void)strncat(fullname, name_template, strlen(name_template));
   190   assert((size_t)n == fullname_len, "Unexpected number of characters in string");
   190 
   191 
   191   os::native_path(fullname);
   192   os::native_path(fullname);
   192 
   193 
   193   sigset_t set, oldset;
   194   sigset_t set, oldset;
   194   int ret = sigfillset(&set);
   195   int ret = sigfillset(&set);