From 75da3bd82ddc10c52bc8091884c6fbe14783fe27 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Tue, 25 Nov 2025 10:58:17 +0800 Subject: [PATCH] refactor: format code. --- installer/sandbox.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/installer/sandbox.c b/installer/sandbox.c index fecdb27cf..55c794439 100644 --- a/installer/sandbox.c +++ b/installer/sandbox.c @@ -21,6 +21,8 @@ #include #define CONFIG_FILE ".sandbox.conf" +#define KEY_BANNED_HOSTS "SANDBOX_PYTHON_BANNED_HOSTS" +#define KEY_ALLOW_SUBPROCESS "SANDBOX_PYTHON_ALLOW_SUBPROCESS" static char *banned_hosts = NULL; static int allow_subprocess = 0; // 默认禁止 @@ -57,10 +59,10 @@ static void load_sandbox_config() { while (*value == ' ' || *value == '\t') value++; char *vend = value + strlen(value) - 1; while (vend > value && (*vend == ' ' || *vend == '\t')) *vend-- = '\0'; - if (strcmp(key, "SANDBOX_PYTHON_BANNED_HOSTS") == 0) { + if (strcmp(key, KEY_BANNED_HOSTS) == 0) { free(banned_hosts); banned_hosts = strdup(value); - } else if (strcmp(key, "SANDBOX_PYTHON_ALLOW_SUBPROCESS") == 0) { + } else if (strcmp(key, KEY_ALLOW_SUBPROCESS) == 0) { allow_subprocess = atoi(value); } }