diff --git a/frameworks/libhilog/BUILD.gn b/frameworks/libhilog/BUILD.gn index b4e3821db91f73402cb746fae1b1f4029430f73e..86b485aab039a96fa56fb06eaa68d9c962c96aa2 100644 --- a/frameworks/libhilog/BUILD.gn +++ b/frameworks/libhilog/BUILD.gn @@ -135,12 +135,12 @@ ohos_source_set("libhilog_base_source") { vsnprintf_sources = [ "$vsnprintf_root/vsnprintf_s_p.c" ] sources = [ "$libhilog_base_root/hilog_base.c" ] - sources += vsnprintf_sources defines = [ "__RECV_MSG_WITH_UCRED_", "HILOG_PROHIBIT_ALLOCATION", ] + sources += vsnprintf_sources public_configs = [ ":libhilog_base_config" ] configs = [ ":libhilog_base_config" ] diff --git a/frameworks/libhilog/base/hilog_base.c b/frameworks/libhilog/base/hilog_base.c index 7e344f657dc192886e543ac1e2aaed751e969b9d..02e2756b37377b054ebc332534227db0e2283eca 100644 --- a/frameworks/libhilog/base/hilog_base.c +++ b/frameworks/libhilog/base/hilog_base.c @@ -38,6 +38,10 @@ static int SendMessage(HilogMsg *header, const char *tag, uint16_t tagLen, const // The hilogbase interface cannot has mutex, so need to re-open and connect to the socketof the hilogd // server each time you write logs. Althougth there is some overhead, you can only do this. int socketFd = TEMP_FAILURE_RETRY(socket(AF_UNIX, SOCKET_TYPE, 0)); + if (tagLen == 0) { + // only test + tagLen = 0; + } if (socketFd < 0) { dprintf(ERROR_FD, "HiLogBase: Can't create socket! Errno: %d\n", errno); return socketFd;