From 4dd9e92c0e5fa5aae6f3fc9d0c1d7557d60cf590 Mon Sep 17 00:00:00 2001 From: fan-jingle Date: Thu, 7 Aug 2025 10:51:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9appspawn=20=E5=91=8A?= =?UTF-8?q?=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fan-jingle --- service/hnp/base/hnp_sal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/service/hnp/base/hnp_sal.c b/service/hnp/base/hnp_sal.c index e56474a2..afed801c 100644 --- a/service/hnp/base/hnp_sal.c +++ b/service/hnp/base/hnp_sal.c @@ -65,15 +65,15 @@ static int CheckSymlink(HnpCfgInfo *hnpCfg, const char *linkPath) // 获取软链信息 char targetPath[MAX_FILE_PATH_LEN] = {0}; - size_t bytes = readlink(linkPath, targetPath, MAX_FILE_PATH_LEN); + ssize_t bytes = readlink(linkPath, targetPath, MAX_FILE_PATH_LEN); HNP_ERROR_CHECK(bytes > 0, return HNP_ERRNO_SYMLINK_CHECK_FAILED, - "readlink failed %{public}d %{public}zu %{public}s", errno, bytes, linkPath); + "readlink failed %{public}d %{public}zd %{public}s", errno, bytes, linkPath); // 获取软连接所在目录 char linkCopy[MAX_FILE_PATH_LEN] = {0}; - bytes = snprintf_s(linkCopy, MAX_FILE_PATH_LEN, MAX_FILE_PATH_LEN - 1, + int ret = snprintf_s(linkCopy, MAX_FILE_PATH_LEN, MAX_FILE_PATH_LEN - 1, "%s", linkPath); - HNP_ERROR_CHECK(bytes > 0, return HNP_ERRNO_SYMLINK_CHECK_FAILED, + HNP_ERROR_CHECK(ret > 0, return HNP_ERRNO_SYMLINK_CHECK_FAILED, "copy link path failed %{public}d", errno); const char *pos = strrchr(linkCopy, DIR_SPLIT_SYMBOL); HNP_ERROR_CHECK(pos != NULL && pos - linkCopy < MAX_FILE_PATH_LEN - 1, @@ -82,9 +82,9 @@ static int CheckSymlink(HnpCfgInfo *hnpCfg, const char *linkPath) // 拼接源文件路径 char sourcePath[MAX_FILE_PATH_LEN] = {0} ; - bytes = snprintf_s(sourcePath, MAX_FILE_PATH_LEN, MAX_FILE_PATH_LEN - 1, + ret = snprintf_s(sourcePath, MAX_FILE_PATH_LEN, MAX_FILE_PATH_LEN - 1, "%s/%s", linkCopy, targetPath); - HNP_ERROR_CHECK(bytes > 0, return HNP_ERRNO_SYMLINK_CHECK_FAILED, + HNP_ERROR_CHECK(ret > 0, return HNP_ERRNO_SYMLINK_CHECK_FAILED, "Get Source file path failed"); // 源文件不存在 允许覆盖 HNP_ONLY_EXPER(access(sourcePath, F_OK) != 0, return 0); -- Gitee