equal
deleted
inserted
replaced
2968 } |
2968 } |
2969 |
2969 |
2970 int os::create_file_for_heap(const char* dir) { |
2970 int os::create_file_for_heap(const char* dir) { |
2971 |
2971 |
2972 const char name_template[] = "/jvmheap.XXXXXX"; |
2972 const char name_template[] = "/jvmheap.XXXXXX"; |
2973 char *fullname = (char*)os::malloc((strlen(dir) + strlen(name_template) + 1), mtInternal); |
2973 |
|
2974 size_t fullname_len = strlen(dir) + strlen(name_template); |
|
2975 char *fullname = (char*)os::malloc(fullname_len + 1, mtInternal); |
2974 if (fullname == NULL) { |
2976 if (fullname == NULL) { |
2975 vm_exit_during_initialization(err_msg("Malloc failed during creation of backing file for heap (%s)", os::strerror(errno))); |
2977 vm_exit_during_initialization(err_msg("Malloc failed during creation of backing file for heap (%s)", os::strerror(errno))); |
2976 return -1; |
2978 return -1; |
2977 } |
2979 } |
2978 |
2980 int n = snprintf(fullname, fullname_len + 1, "%s%s", dir, name_template); |
2979 (void)strncpy(fullname, dir, strlen(dir)+1); |
2981 assert((size_t)n == fullname_len, "Unexpected number of characters in string"); |
2980 (void)strncat(fullname, name_template, strlen(name_template)); |
|
2981 |
2982 |
2982 os::native_path(fullname); |
2983 os::native_path(fullname); |
2983 |
2984 |
2984 char *path = _mktemp(fullname); |
2985 char *path = _mktemp(fullname); |
2985 if (path == NULL) { |
2986 if (path == NULL) { |