From 80cfefddd53d739a9154f591cbce24547073ba54 Mon Sep 17 00:00:00 2001 From: fengjq Date: Tue, 1 Aug 2023 14:39:19 +0800 Subject: [PATCH] Bug fixed, returns the corresponding exception result. Signed-off-by: fengjq --- interfaces/kits/js/src/mod_fs/properties/truncate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/properties/truncate.cpp b/interfaces/kits/js/src/mod_fs/properties/truncate.cpp index a793c2811..71776533f 100644 --- a/interfaces/kits/js/src/mod_fs/properties/truncate.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/truncate.cpp @@ -82,8 +82,8 @@ static NError TruncateCore(napi_env env, FileInfo &fileInfo, int64_t truncateLen } int ret = uv_fs_ftruncate(nullptr, ftruncate_req.get(), fileInfo.fdg->GetFD(), truncateLen, nullptr); if (ret < 0) { - HILOGE("Failed to truncate file by fd"); - return NError(EINVAL); + HILOGE("Failed to truncate file by fd for libuv error %{public}d", ret); + return NError(ret); } } return NError(ERRNO_NOERR); -- Gitee