From 452fe3d50899739b2e9362935939cf54392a4420 Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Sat, 20 Sep 2025 00:27:48 +0800 Subject: [PATCH] uid_sanner: Ensure the `/data/misc/user_uid/` directory is set to 777 permissions to prevent read/write issues. --- userspace/user_scanner/jni/uid_scanner.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/userspace/user_scanner/jni/uid_scanner.c b/userspace/user_scanner/jni/uid_scanner.c index 433d241e..fbbd9678 100644 --- a/userspace/user_scanner/jni/uid_scanner.c +++ b/userspace/user_scanner/jni/uid_scanner.c @@ -209,7 +209,19 @@ int retry_operation(int (*operation)(void), const char *op_name) { } void ensure_directory_exists(void) { - system("mkdir -p /data/misc/user_uid"); + const char *path = "/data/misc/user_uid"; + struct stat st; + + if (stat(path, &st) != 0) { + if (mkdir(path, 0777) != 0) { + LOGE("Failed to create directory %s: %s", path, strerror(errno)); + return; + } + } + + if (chmod(path, 0777) != 0) { + LOGE("Failed to chmod directory %s: %s", path, strerror(errno)); + } } void parse_config_line(const char *key, const char *value) {