From b1ffcf37d4bb1b059d2feeea6f4b88593a91d39e Mon Sep 17 00:00:00 2001 From: hw_llm Date: Thu, 14 Nov 2024 16:05:07 +0800 Subject: [PATCH] =?UTF-8?q?Description:=20=E4=BF=AE=E5=A4=8Ddmesg=20?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=96=87=E4=BB=B6=E6=BC=8F=E6=B4=9E=EF=BC=8C?= =?UTF-8?q?=E5=8F=AA=E5=85=81=E8=AE=B8dmesg=E8=BE=93=E5=87=BA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=88=B0/temp/=E7=9B=AE=E5=BD=95=E4=B8=8B=20IssueNo:?= =?UTF-8?q?=20https://gitee.com/openharmony/kernel=5Fliteos=5Fa/issues/IB4?= =?UTF-8?q?D03=3Ffrom=3Dproject-issue=20Feature=20Or=20Bugfix:=20Feature?= =?UTF-8?q?=20Binary=20Source:=20No=20Signed-off-by:=20hw=5Fllm=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/full/src/cmds/dmesg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shell/full/src/cmds/dmesg.c b/shell/full/src/cmds/dmesg.c index a03abe81..90ff1fd5 100644 --- a/shell/full/src/cmds/dmesg.c +++ b/shell/full/src/cmds/dmesg.c @@ -655,6 +655,12 @@ INT32 OsDmesgWrite2File(const CHAR *fullpath, const CHAR *buf, UINT32 logSize) { INT32 ret; + const CHAR *prefix = "/temp/"; + INT32 prefixLen = strlen(prefix); + if (strncmp(fullpath, prefix, prefixLen) != 0) { + return -1; + } + INT32 fd = open(fullpath, O_CREAT | O_RDWR | O_APPEND, 0644); /* 0644:file right */ if (fd < 0) { return -1; -- Gitee