From d927e5680935440155d977f7fa2c2f75395e4794 Mon Sep 17 00:00:00 2001
From: "lingjun.cg" <lingjun.cg@alibaba-inc.com>
Date: Thu, 31 Oct 2024 10:07:25 +0800
Subject: [PATCH] [JFR] Test
 jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java crash
 Summary: The format of snprintf expect a string, but pass an integer value in
 function create_emergency_chunk_path which defined in file
 jfrEmergencyDump.cpp. Testing:
 jfr/event/gc/detailed/TestPromotionFailedEventWithParallelScavenge.java
 Reviewers: sendaoYan, D-D-H Issue:
 https://github.com/dragonwell-project/dragonwell8/issues/690

---
 .../src/share/vm/jfr/recorder/repository/jfrEmergencyDump.cpp   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hotspot/src/share/vm/jfr/recorder/repository/jfrEmergencyDump.cpp b/hotspot/src/share/vm/jfr/recorder/repository/jfrEmergencyDump.cpp
index debe852b03d..692d3e7127b 100644
--- a/hotspot/src/share/vm/jfr/recorder/repository/jfrEmergencyDump.cpp
+++ b/hotspot/src/share/vm/jfr/recorder/repository/jfrEmergencyDump.cpp
@@ -306,7 +306,7 @@ static const char* create_emergency_chunk_path(const char* repository_path) {
     return NULL;
   }
   // append the individual substrings
-  jio_snprintf(chunk_path, chunkname_max_len, "%s%s%s%s", repository_path_len, os::file_separator(), date_time_buffer, chunk_file_jfr_ext);
+  jio_snprintf(chunk_path, chunkname_max_len, "%s%s%s%s", repository_path, os::file_separator(), date_time_buffer, chunk_file_jfr_ext);
   return chunk_path;
 }