src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp
changeset 53762 65deccd64f3a
parent 51106 f605c91e5219
child 53897 0abec72a3ac2
equal deleted inserted replaced
53761:e77095ade618 53762:65deccd64f3a
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   207   }
   207   }
   208   char* entry_name = NEW_RESOURCE_ARRAY_RETURN_NULL(char, entry_len + 1);
   208   char* entry_name = NEW_RESOURCE_ARRAY_RETURN_NULL(char, entry_len + 1);
   209   if (entry_name == NULL) {
   209   if (entry_name == NULL) {
   210     return NULL;
   210     return NULL;
   211   }
   211   }
   212   strncpy(entry_name, entry, entry_len);
   212   strncpy(entry_name, entry, entry_len + 1);
   213   entry_name[entry_len] = '\0';
       
   214   const char* const fully_qualified_path_entry = fully_qualified(entry_name);
   213   const char* const fully_qualified_path_entry = fully_qualified(entry_name);
   215   if (NULL == fully_qualified_path_entry) {
   214   if (NULL == fully_qualified_path_entry) {
   216     return NULL;
   215     return NULL;
   217   }
   216   }
   218   const fio_fd entry_fd = open_existing(fully_qualified_path_entry);
   217   const fio_fd entry_fd = open_existing(fully_qualified_path_entry);
   330     const size_t emergency_filename_length = strlen(buffer);
   329     const size_t emergency_filename_length = strlen(buffer);
   331     emergency_dump_path = NEW_RESOURCE_ARRAY_RETURN_NULL(char, emergency_filename_length + 1);
   330     emergency_dump_path = NEW_RESOURCE_ARRAY_RETURN_NULL(char, emergency_filename_length + 1);
   332     if (NULL == emergency_dump_path) {
   331     if (NULL == emergency_dump_path) {
   333       return NULL;
   332       return NULL;
   334     }
   333     }
   335     strncpy(emergency_dump_path, buffer, emergency_filename_length);
   334     strncpy(emergency_dump_path, buffer, emergency_filename_length + 1);
   336     emergency_dump_path[emergency_filename_length] = '\0';
       
   337   }
   335   }
   338   return emergency_dump_path;
   336   return emergency_dump_path;
   339 }
   337 }
   340 
   338 
   341 // Caller needs ResourceMark
   339 // Caller needs ResourceMark
   405   const size_t path_len = strlen(path);
   403   const size_t path_len = strlen(path);
   406   _path = JfrCHeapObj::new_array<char>(path_len + 1);
   404   _path = JfrCHeapObj::new_array<char>(path_len + 1);
   407   if (_path == NULL) {
   405   if (_path == NULL) {
   408     return false;
   406     return false;
   409   }
   407   }
   410   strncpy(_path, path, path_len);
   408   strncpy(_path, path, path_len + 1);
   411   _path[path_len] = '\0';
       
   412   return true;
   409   return true;
   413 }
   410 }
   414 
   411 
   415 void JfrRepository::set_chunk_path(const char* path) {
   412 void JfrRepository::set_chunk_path(const char* path) {
   416   assert(JfrStream_lock->owned_by_self(), "invariant");
   413   assert(JfrStream_lock->owned_by_self(), "invariant");