From a8382a5eada909c988dc30bedaa828d0dce7154e Mon Sep 17 00:00:00 2001 From: zhushuanghong Date: Wed, 9 Apr 2025 15:29:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhushuanghong --- services/native/src/work_scheduler_service.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/native/src/work_scheduler_service.cpp b/services/native/src/work_scheduler_service.cpp index ca9315b..a1b82b1 100644 --- a/services/native/src/work_scheduler_service.cpp +++ b/services/native/src/work_scheduler_service.cpp @@ -1245,6 +1245,10 @@ int32_t WorkSchedulerService::CreateNodeDir(std::string dir) int32_t WorkSchedulerService::CreateNodeFile(std::string filePath) { if (access(filePath.c_str(), 0) != 0) { + if (realpath(filePath.c_str(), nullptr) == nullptr) { + WS_HILOGE("Fail to resolved file: %{private}s, errno: %{public}s", filePath.c_str(), strerror(errno)); + return errno; + } FILE *file = fopen(filePath.c_str(), "w+"); if (file == nullptr) { WS_HILOGE("Fail to open file: %{private}s, errno: %{public}s", filePath.c_str(), strerror(errno)); -- Gitee From d97734ca0169f371b373837a5c666edbc26bd8f3 Mon Sep 17 00:00:00 2001 From: zhushuanghong Date: Wed, 9 Apr 2025 17:50:36 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhushuanghong --- services/native/src/conditions/timer_listener.cpp | 1 + services/native/src/work_conn_manager.cpp | 1 + services/native/src/work_policy_manager.cpp | 1 + services/native/src/work_scheduler_service.cpp | 3 ++- services/native/src/work_status.cpp | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/services/native/src/conditions/timer_listener.cpp b/services/native/src/conditions/timer_listener.cpp index e5b5800..edcc675 100644 --- a/services/native/src/conditions/timer_listener.cpp +++ b/services/native/src/conditions/timer_listener.cpp @@ -17,6 +17,7 @@ #include "work_queue_event_handler.h" #include "work_sched_hilog.h" #include "conditions/timer_info.h" +#include namespace OHOS { namespace WorkScheduler { diff --git a/services/native/src/work_conn_manager.cpp b/services/native/src/work_conn_manager.cpp index 2c3c0a8..3c27bb6 100644 --- a/services/native/src/work_conn_manager.cpp +++ b/services/native/src/work_conn_manager.cpp @@ -26,6 +26,7 @@ #include "work_sched_hilog.h" #include "work_sched_utils.h" #include "errors.h" +#include #ifdef DEVICE_STANDBY_ENABLE #include "standby_service_client.h" diff --git a/services/native/src/work_policy_manager.cpp b/services/native/src/work_policy_manager.cpp index 35a6508..21ab9a3 100644 --- a/services/native/src/work_policy_manager.cpp +++ b/services/native/src/work_policy_manager.cpp @@ -30,6 +30,7 @@ #include "work_sched_utils.h" #include "watchdog.h" #include "work_sched_data_manager.h" +#include using namespace std; using namespace OHOS::AppExecFwk; diff --git a/services/native/src/work_scheduler_service.cpp b/services/native/src/work_scheduler_service.cpp index a1b82b1..d3c4afc 100644 --- a/services/native/src/work_scheduler_service.cpp +++ b/services/native/src/work_scheduler_service.cpp @@ -1245,7 +1245,8 @@ int32_t WorkSchedulerService::CreateNodeDir(std::string dir) int32_t WorkSchedulerService::CreateNodeFile(std::string filePath) { if (access(filePath.c_str(), 0) != 0) { - if (realpath(filePath.c_str(), nullptr) == nullptr) { + char resolvedPath[PATH_MAX]; + if (realpath(filePath.c_str(), resolvedPath) == nullptr) { WS_HILOGE("Fail to resolved file: %{private}s, errno: %{public}s", filePath.c_str(), strerror(errno)); return errno; } diff --git a/services/native/src/work_status.cpp b/services/native/src/work_status.cpp index ee3dd10..0cbc031 100644 --- a/services/native/src/work_status.cpp +++ b/services/native/src/work_status.cpp @@ -30,6 +30,7 @@ #include "work_sched_data_manager.h" #include "work_sched_config.h" #include +#include using namespace std; -- Gitee From f40814212a1e2c92dd543b44ca66182664d66395 Mon Sep 17 00:00:00 2001 From: zhushuanghong Date: Thu, 10 Apr 2025 10:35:46 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhushuanghong --- services/native/src/work_scheduler_service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/native/src/work_scheduler_service.cpp b/services/native/src/work_scheduler_service.cpp index d3c4afc..12933c6 100644 --- a/services/native/src/work_scheduler_service.cpp +++ b/services/native/src/work_scheduler_service.cpp @@ -1245,7 +1245,7 @@ int32_t WorkSchedulerService::CreateNodeDir(std::string dir) int32_t WorkSchedulerService::CreateNodeFile(std::string filePath) { if (access(filePath.c_str(), 0) != 0) { - char resolvedPath[PATH_MAX]; + char resolvedPath[PATH_MAX] = {0}; if (realpath(filePath.c_str(), resolvedPath) == nullptr) { WS_HILOGE("Fail to resolved file: %{private}s, errno: %{public}s", filePath.c_str(), strerror(errno)); return errno; -- Gitee From cd83ec387f246ae2d2bf0bc9403a98417710c2e6 Mon Sep 17 00:00:00 2001 From: zhushuanghong Date: Thu, 10 Apr 2025 11:27:45 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhushuanghong --- services/native/src/conditions/timer_listener.cpp | 1 - services/native/src/work_conn_manager.cpp | 1 - services/native/src/work_policy_manager.cpp | 1 - services/native/src/work_status.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/services/native/src/conditions/timer_listener.cpp b/services/native/src/conditions/timer_listener.cpp index edcc675..e5b5800 100644 --- a/services/native/src/conditions/timer_listener.cpp +++ b/services/native/src/conditions/timer_listener.cpp @@ -17,7 +17,6 @@ #include "work_queue_event_handler.h" #include "work_sched_hilog.h" #include "conditions/timer_info.h" -#include namespace OHOS { namespace WorkScheduler { diff --git a/services/native/src/work_conn_manager.cpp b/services/native/src/work_conn_manager.cpp index 3c27bb6..2c3c0a8 100644 --- a/services/native/src/work_conn_manager.cpp +++ b/services/native/src/work_conn_manager.cpp @@ -26,7 +26,6 @@ #include "work_sched_hilog.h" #include "work_sched_utils.h" #include "errors.h" -#include #ifdef DEVICE_STANDBY_ENABLE #include "standby_service_client.h" diff --git a/services/native/src/work_policy_manager.cpp b/services/native/src/work_policy_manager.cpp index 21ab9a3..35a6508 100644 --- a/services/native/src/work_policy_manager.cpp +++ b/services/native/src/work_policy_manager.cpp @@ -30,7 +30,6 @@ #include "work_sched_utils.h" #include "watchdog.h" #include "work_sched_data_manager.h" -#include using namespace std; using namespace OHOS::AppExecFwk; diff --git a/services/native/src/work_status.cpp b/services/native/src/work_status.cpp index 0cbc031..ee3dd10 100644 --- a/services/native/src/work_status.cpp +++ b/services/native/src/work_status.cpp @@ -30,7 +30,6 @@ #include "work_sched_data_manager.h" #include "work_sched_config.h" #include -#include using namespace std; -- Gitee