Skip to content

Commit 75da3bd

Browse files
refactor: format code.
1 parent 5e909a4 commit 75da3bd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

installer/sandbox.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include <dlfcn.h>
2222

2323
#define CONFIG_FILE ".sandbox.conf"
24+
#define KEY_BANNED_HOSTS "SANDBOX_PYTHON_BANNED_HOSTS"
25+
#define KEY_ALLOW_SUBPROCESS "SANDBOX_PYTHON_ALLOW_SUBPROCESS"
2426

2527
static char *banned_hosts = NULL;
2628
static int allow_subprocess = 0; // 默认禁止
@@ -57,10 +59,10 @@ static void load_sandbox_config() {
5759
while (*value == ' ' || *value == '\t') value++;
5860
char *vend = value + strlen(value) - 1;
5961
while (vend > value && (*vend == ' ' || *vend == '\t')) *vend-- = '\0';
60-
if (strcmp(key, "SANDBOX_PYTHON_BANNED_HOSTS") == 0) {
62+
if (strcmp(key, KEY_BANNED_HOSTS) == 0) {
6163
free(banned_hosts);
6264
banned_hosts = strdup(value);
63-
} else if (strcmp(key, "SANDBOX_PYTHON_ALLOW_SUBPROCESS") == 0) {
65+
} else if (strcmp(key, KEY_ALLOW_SUBPROCESS) == 0) {
6466
allow_subprocess = atoi(value);
6567
}
6668
}

0 commit comments

Comments
 (0)