From 2db7ae30f91b4ebe6cb9e1af7713e543b3a310c6 Mon Sep 17 00:00:00 2001 From: Changbin Du Date: Sat, 27 Jan 2024 01:10:16 +0800 Subject: [PATCH] Restorecon for "/data/log/startup/" Now "/data/log/startup/" has its own label 'bootuptrace_file'. Signed-off-by: Changbin Du --- services/modules/bootevent/bootevent.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/modules/bootevent/bootevent.c b/services/modules/bootevent/bootevent.c index 048df9446..fb5191934 100755 --- a/services/modules/bootevent/bootevent.c +++ b/services/modules/bootevent/bootevent.c @@ -29,6 +29,10 @@ #include "init_cmds.h" #include "config_policy_utils.h" +#ifdef WITH_SELINUX +#include +#endif + static int GetBootEventEnable(void) { char bootEventOpen[6] = ""; // 6 is length of bool value @@ -213,7 +217,12 @@ static int BootEventTraversal(ListNode *node, void *root) static int SaveServiceBootEvent() { INIT_CHECK(GetBootEventEnable(), return 0); + CheckAndCreatFile(BOOTEVENT_OUTPUT_PATH "bootup.trace", S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); +#ifdef WITH_SELINUX + (void)RestoreconRecurse(BOOTEVENT_OUTPUT_PATH); +#endif + FILE *tmpFile = fopen(BOOTEVENT_OUTPUT_PATH "bootup.trace", "wr"); INIT_CHECK_RETURN_VALUE(tmpFile != NULL, -1); cJSON *root = cJSON_CreateArray(); -- Gitee