#include "su.h"
-static void kill_child(pid_t pid) {
- LOGD("killing child %d", pid);
- if (pid) {
- sigset_t set, old;
-
- sigemptyset(&set);
- sigaddset(&set, SIGCHLD);
- if (sigprocmask(SIG_BLOCK, &set, &old)) {
- PLOGE("sigprocmask(SIG_BLOCK)");
- return;
- }
- if (kill(pid, SIGKILL))
- PLOGE("kill (%d)", pid);
- else if (sigsuspend(&old) && errno != EINTR)
- PLOGE("sigsuspend");
- if (sigprocmask(SIG_SETMASK, &old, NULL))
- PLOGE("sigprocmask(SIG_BLOCK)");
- }
-}
-
// TODO: leverage this with exec_log?
static int silent_run(char* command) {
char *args[] = { "sh", "-c", command, NULL, };
ctx->from.name, ctx->to.name,
ctx->from.uid, ctx->to.uid, get_command(&ctx->to), policy == ALLOW ? "allow" : "deny", ctx->user.android_user_id);
silent_run(user_result_command);
- LOGD(user_result_command);
}
char result_command[ARG_MAX];
if (mode[last] == '\n')
mode[last] = '\0';
fgets(mode, sizeof(mode), fp);
- LOGD("multiuser mode: %s", mode);
if (strcmp(mode, MULTIUSER_VALUE_USER) == 0) {
ret = MULTIUSER_MODE_USER;
} else if (strcmp(mode, MULTIUSER_VALUE_OWNER_MANAGED) == 0) {
tv.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(serv_fd, &fds);
- LOGD("select");
do {
rc = select(serv_fd + 1, &fds, NULL, NULL, &tv);
} while (rc < 0 && errno == EINTR);
}
int ret = mkdir(REQUESTOR_CACHE_PATH, 0770);
- LOGD("mkdir: %d", ret);
if (chown(REQUESTOR_CACHE_PATH, st.st_uid, st.st_gid)) {
PLOGE("chown (%s, %ld, %ld)", REQUESTOR_CACHE_PATH, st.st_uid, st.st_gid);
deny(&ctx);