From 8f6a1dd33c59164070e8d2fb5abbd3e76ef8ac8e Mon Sep 17 00:00:00 2001 From: pcwlno1 Date: Thu, 22 Jul 2021 09:29:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E4=BF=9D=E5=AD=98bbox=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、在日志写如完成之后执行fsync确保落盘。 Close #I41UTP Signed-off-by: qidechun --- kernel/common/blackbox/los_blackbox_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/common/blackbox/los_blackbox_common.c b/kernel/common/blackbox/los_blackbox_common.c index c7ae0795..813ab8d9 100644 --- a/kernel/common/blackbox/los_blackbox_common.c +++ b/kernel/common/blackbox/los_blackbox_common.c @@ -78,6 +78,7 @@ int FullWriteFile(const char *filePath, const char *buf, size_t bufSize, int isA totalToWrite -= writeThisTime; totalWrite += writeThisTime; } + (void)fsync(fd); (void)close(fd); return (totalWrite == (int)bufSize) ? 0 : -1; @@ -124,4 +125,4 @@ bool IsLogPartReady(void) { return TRUE; } -#endif \ No newline at end of file +#endif