diff --git a/services/apphilogcat/hiview_applogcat.c b/services/apphilogcat/hiview_applogcat.c index e7a750939c8ea194a14152b9f4e4ba27210a57a9..c4a5878ffa29efc219d38b733750084c8660deb6 100644 --- a/services/apphilogcat/hiview_applogcat.c +++ b/services/apphilogcat/hiview_applogcat.c @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) while (1) { (void)memset_s(buf, HILOG_LOGBUFFER + 1, 0, HILOG_LOGBUFFER + 1); ret = read(fd, buf, HILOG_LOGBUFFER); - if (ret < sizeof(struct HiLogEntry)) { + if (ret < 0 || ret < sizeof(struct HiLogEntry)) { continue; } struct HiLogEntry *head = (struct HiLogEntry *)buf;