1 Star 0 Fork 81

fuowang/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
0044-Record-file-descriptor-when-ExtensiveErrorReports-is.patch 1.28 KB
一键复制 编辑 原始数据 按行查看 历史
Date: Fri, 9 Jun 2023 11:10:42 +0800
Subject: [PATCH 44/59] Record file descriptor when ExtensiveErrorReports is enabled
---
hotspot/src/os/linux/vm/os_linux.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index ce4c6de09..a05ad07cf 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -2586,7 +2586,7 @@ void os::pd_print_file_descriptor(outputStream* st) {
// Scan the directory, get symbolic link value
struct dirent *ptr;
ssize_t readlink_ret = 0;
- char symbolic_link_value[MAX_PATH_LEN] = {0};
+ char symbolic_link_value[MAX_PATH_LEN + 1] = {0};
char filename[MAX_PATH_LEN] = {0};
unsigned long file_count = 0;
while ((ptr = readdir(dir)) != NULL) {
@@ -2595,6 +2595,7 @@ void os::pd_print_file_descriptor(outputStream* st) {
(void) snprintf(filename, MAX_PATH_LEN, "%s%s", process_path, ptr->d_name);
readlink_ret = readlink(filename, symbolic_link_value, MAX_PATH_LEN);
if (readlink_ret > 0) {
+ symbolic_link_value[readlink_ret] = '\0';
st->print_cr("%s -> %s", ptr->d_name, symbolic_link_value);
} else {
st->print_cr("%s: readlink failed, errno: %d", ptr->d_name, errno);
--
2.22.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fuowang/openjdk-1.8.0.git
git@gitee.com:fuowang/openjdk-1.8.0.git
fuowang
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助