From 2d8f85e519043c9aad7c0b02d17b5a2f5c2fb6f7 Mon Sep 17 00:00:00 2001 From: wangkexin Date: Mon, 20 May 2024 02:33:09 +0000 Subject: [PATCH] update frameworks/intl/src/utils.cpp. Signed-off-by: wangkexin --- frameworks/intl/src/utils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/intl/src/utils.cpp b/frameworks/intl/src/utils.cpp index c7957aef..7ff0712e 100644 --- a/frameworks/intl/src/utils.cpp +++ b/frameworks/intl/src/utils.cpp @@ -224,12 +224,12 @@ bool IsDirExist(const char *path) if (!(path && *path)) { return false; } - char resolved_path[PATH_MAX]; - if (realpath(path, resolved_path) == nullptr) { + char* resolvedPath = new char[PATH_MAX]; + if (realpath(path, resolvedPath) == nullptr) { return false; } struct stat buf; - return stat(resolved_path, &buf) == 0 && S_ISDIR(buf.st_mode); + return stat(resolvedPath, &buf) == 0 && S_ISDIR(buf.st_mode); } std::string trim(std::string &s)