diff --git a/kernel/common/los_hilog.c b/kernel/common/los_hilog.c index f4bc5f9dbc4a8413ab348ea8fd17fe63dc1acc23..6d9fbc6fb284463107ae140ce1370e69a40ccae1 100644 --- a/kernel/common/los_hilog.c +++ b/kernel/common/los_hilog.c @@ -201,6 +201,13 @@ static ssize_t HiLogRead(struct file *filep, char *buffer, size_t bufLen) HiLogBufferDec(header.len); retval = header.len + sizeof(header); out: + if (retval == -ENOMEM) { + // clean ring buffer + g_hiLogDev.writeOffset = 0; + g_hiLogDev.headOffset = 0; + g_hiLogDev.size = 0; + g_hiLogDev.count = 0; + } (VOID)LOS_MuxRelease(&g_hiLogDev.mtx); return retval; }