mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-23 08:09:59 +00:00
Description:Code optimization
Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: lwx1281857 <linnanmu@h-partners.com>
This commit is contained in:
parent
f1b1085a21
commit
0c2f809059
@ -62,10 +62,10 @@ declare_args() {
|
||||
init_startup_feature_system_call_switch = false
|
||||
|
||||
#deps param_watcher xcollie
|
||||
paramwatcher_hicollie_enable = true
|
||||
init_paramwatcher_hicollie_enable = true
|
||||
if (defined(global_parts_info) &&
|
||||
!defined(global_parts_info.hiviewdfx_hicollie)) {
|
||||
paramwatcher_hicollie_enable = false
|
||||
init_paramwatcher_hicollie_enable = false
|
||||
}
|
||||
|
||||
# seccomp privilege
|
||||
|
@ -27,8 +27,9 @@ shared_library("libinitsync_shared") {
|
||||
]
|
||||
public_deps = [ "//base/startup/init/services/log:init_log" ]
|
||||
|
||||
public_external_deps = [ "bounds_checking_function:libsec_shared" ]
|
||||
external_deps = [ "bounds_checking_function:libsec_shared" ]
|
||||
}
|
||||
|
||||
static_library("libinitsync_static") {
|
||||
sources = [ "src/init_sync.c" ]
|
||||
include_dirs = [
|
||||
|
@ -23,7 +23,7 @@ if (defined(ohos_lite)) {
|
||||
static_library("libsocket") {
|
||||
sources = service_socket_sources
|
||||
include_dirs = service_socket_include
|
||||
external_deps = [ "bounds_checking_function:libsec_shared" ]
|
||||
external_deps = [ "bounds_checking_function:libsec_static" ]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -32,7 +32,7 @@ if (defined(ohos_lite)) {
|
||||
ohos_static_library("libsocket") {
|
||||
sources = service_socket_sources
|
||||
include_dirs = service_socket_include
|
||||
external_deps = [ "bounds_checking_function:libsec_shared" ]
|
||||
external_deps = [ "bounds_checking_function:libsec_static" ]
|
||||
part_name = "init"
|
||||
subsystem_name = "startup"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -60,7 +60,7 @@ ohos_shared_library("param_watcher") {
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
defines = [ "HICOLLIE_ENABLE" ]
|
||||
}
|
||||
|
@ -54,10 +54,8 @@ int32_t WatcherManagerStub::OnRemoteRequest(uint32_t code,
|
||||
}
|
||||
case static_cast<uint32_t>(ParamWatcherInterfaceCode::ADD_REMOTE_AGENT): {
|
||||
auto remote = data.ReadRemoteObject();
|
||||
// 0 is invalid watcherId
|
||||
uint32_t id = data.ReadUint32();
|
||||
sptr<IWatcher> watcher = new WatcherProxy(remote);
|
||||
uint32_t remoteWatcherId = AddRemoteWatcher(id, watcher);
|
||||
uint32_t remoteWatcherId = AddRemoteWatcher(data.ReadUint32(), watcher);
|
||||
reply.WriteUint32(remoteWatcherId);
|
||||
break;
|
||||
}
|
||||
|
@ -2972,7 +2972,7 @@ ohos_fuzztest("AddRemoteWatcherFuzzTest") {
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
}
|
||||
|
||||
@ -2984,7 +2984,7 @@ ohos_fuzztest("AddRemoteWatcherFuzzTest") {
|
||||
]
|
||||
sources += [ "addremotewatcher_fuzzer/addremotewatcher_fuzzer.cpp" ]
|
||||
defines = [ "STARTUP_INIT_TEST" ]
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
defines += [ "HICOLLIE_ENABLE" ]
|
||||
}
|
||||
}
|
||||
@ -3024,7 +3024,7 @@ ohos_fuzztest("DelRemoteWatcherFuzzTest") {
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
}
|
||||
|
||||
@ -3036,7 +3036,7 @@ ohos_fuzztest("DelRemoteWatcherFuzzTest") {
|
||||
]
|
||||
sources += [ "delremotewatcher_fuzzer/delremotewatcher_fuzzer.cpp" ]
|
||||
defines = [ "STARTUP_INIT_TEST" ]
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
defines += [ "HICOLLIE_ENABLE" ]
|
||||
}
|
||||
}
|
||||
@ -3075,7 +3075,7 @@ ohos_fuzztest("AddWatcherFuzzTest") {
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
}
|
||||
|
||||
@ -3087,7 +3087,7 @@ ohos_fuzztest("AddWatcherFuzzTest") {
|
||||
]
|
||||
sources += [ "addwatcher_fuzzer/addwatcher_fuzzer.cpp" ]
|
||||
defines = [ "STARTUP_INIT_TEST" ]
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
defines += [ "HICOLLIE_ENABLE" ]
|
||||
}
|
||||
}
|
||||
@ -3125,7 +3125,7 @@ ohos_fuzztest("DelWatcherFuzzTest") {
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
}
|
||||
|
||||
@ -3137,7 +3137,7 @@ ohos_fuzztest("DelWatcherFuzzTest") {
|
||||
]
|
||||
sources += [ "delwatcher_fuzzer/delwatcher_fuzzer.cpp" ]
|
||||
defines = [ "STARTUP_INIT_TEST" ]
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
defines += [ "HICOLLIE_ENABLE" ]
|
||||
}
|
||||
}
|
||||
@ -3175,7 +3175,7 @@ ohos_fuzztest("RefreshWatcherFuzzTest") {
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
external_deps += [ "hicollie:libhicollie" ]
|
||||
}
|
||||
|
||||
@ -3187,7 +3187,7 @@ ohos_fuzztest("RefreshWatcherFuzzTest") {
|
||||
]
|
||||
sources += [ "refreshwatcher_fuzzer/refreshwatcher_fuzzer.cpp" ]
|
||||
defines = [ "STARTUP_INIT_TEST" ]
|
||||
if (paramwatcher_hicollie_enable) {
|
||||
if (init_paramwatcher_hicollie_enable) {
|
||||
defines += [ "HICOLLIE_ENABLE" ]
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +22,12 @@ namespace OHOS {
|
||||
bool FuzzParseUeventConfig(const uint8_t* data, size_t size)
|
||||
{
|
||||
bool result = false;
|
||||
if (size == 0 && size > MAX_ALLOW_SIZE) {
|
||||
if (size == 0 || size > MAX_ALLOW_SIZE) {
|
||||
return false;
|
||||
}
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
char *buffer = new char[size+1];
|
||||
int ret = strcpy_s(buffer, size+1, str.c_str());
|
||||
char *buffer = new char[size + 1];
|
||||
int ret = strcpy_s(buffer, size + 1, str.c_str());
|
||||
if (ret != 0) {
|
||||
delete[] buffer;
|
||||
return false;
|
||||
|
@ -37,8 +37,8 @@ using namespace testing::ext;
|
||||
using namespace std;
|
||||
using namespace OHOS;
|
||||
|
||||
static int g_tokenType = OHOS::Security::AccessToken::TOKEN_HAP;
|
||||
static int g_tokenVerifyResult = 0;
|
||||
int g_tokenType = OHOS::Security::AccessToken::TOKEN_HAP;
|
||||
int g_tokenVerifyResult = 0;
|
||||
namespace OHOS {
|
||||
namespace Security {
|
||||
namespace AccessToken {
|
||||
|
@ -13,9 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "init_unittest.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
@ -25,7 +28,6 @@
|
||||
#include "init_cmds.h"
|
||||
#include "init_log.h"
|
||||
#include "init_service.h"
|
||||
#include "init_unittest.h"
|
||||
#include "init_adapter.h"
|
||||
#include "init_utils.h"
|
||||
#include "loop_event.h"
|
||||
|
@ -370,6 +370,8 @@ HWTEST_F(WatcherProxyUnitTest, Init_TestStop_001, TestSize.Level0)
|
||||
{
|
||||
WatcherProxyUnitTest test;
|
||||
uint32_t watcherId = 0;
|
||||
fdsan_set_error_level(FDSAN_ERROR_LEVEL_DISABLED);
|
||||
|
||||
test.TestAddRemoteWatcher(getpid(), watcherId);
|
||||
test.TestAddWatcher("test.permission.watcher.stop", watcherId);
|
||||
test.TestStop();
|
||||
|
@ -50,7 +50,7 @@ HWTEST_F(SysparaUnitTest, parameterTest001, TestSize.Level0)
|
||||
printf("MarketName =%s\n", GetMarketName());
|
||||
printf("ProductSeries =%s\n", GetProductSeries());
|
||||
printf("ProductModel =%s\n", GetProductModel());
|
||||
printf("ProductModel =%s\n", GetProductModelAlias());
|
||||
printf("ProductModelAlias =%s\n", GetProductModelAlias());
|
||||
printf("SoftwareModel =%s\n", GetSoftwareModel());
|
||||
printf("HardwareModel =%s\n", GetHardwareModel());
|
||||
printf("Software profile =%s\n", GetHardwareProfile());
|
||||
|
Loading…
Reference in New Issue
Block a user