Allow su to work when manager uninstalled

This commit is contained in:
topjohnwu 2017-12-22 00:29:58 +08:00
parent 2b6c271d37
commit 190d857949
2 changed files with 2 additions and 3 deletions

3
db.c
View File

@ -142,8 +142,7 @@ stat_requester:
sprintf(buffer, "%s/0/%s", base, ctx->info->pkg_name); sprintf(buffer, "%s/0/%s", base, ctx->info->pkg_name);
if (stat(buffer, &ctx->info->st) == -1) { if (stat(buffer, &ctx->info->st) == -1) {
LOGE("su: cannot find requester"); LOGE("su: cannot find requester");
ctx->info->policy = DENY; memset(&ctx->info->st, 0, sizeof(ctx->info->st));
ctx->notify = 0;
} }
} }
} }

2
su.c
View File

@ -309,7 +309,7 @@ int su_daemon_main(int argc, char **argv) {
} }
// New request or no db exist, notify user for response // New request or no db exist, notify user for response
if (su_ctx->info->policy == QUERY) { if (su_ctx->info->policy == QUERY && su_ctx->info->st.st_uid != 0) {
socket_serv_fd = socket_create_temp(su_ctx->sock_path, sizeof(su_ctx->sock_path)); socket_serv_fd = socket_create_temp(su_ctx->sock_path, sizeof(su_ctx->sock_path));
setup_sighandlers(cleanup_signal); setup_sighandlers(cleanup_signal);