From c9f390d6e0408678e20445bcd25015452d0a379b Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 20 Nov 2018 01:47:17 -0500 Subject: [PATCH] Abort upon any error occurred --- native/jni/su/su_daemon.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/native/jni/su/su_daemon.cpp b/native/jni/su/su_daemon.cpp index 243d34e83..7d4f7bebb 100644 --- a/native/jni/su/su_daemon.cpp +++ b/native/jni/su/su_daemon.cpp @@ -241,6 +241,9 @@ void su_daemon_handler(int client, struct ucred *credential) { LOGD("su: fork handler\n"); + // Abort upon any error occurred + log_cb.ex = exit; + struct su_context ctx = { .info = info, .pid = credential->pid @@ -273,11 +276,8 @@ void su_daemon_handler(int client, struct ucred *credential) { xstat(pts_slave, &st); // If caller is not root, ensure the owner of pts_slave is the caller - if(st.st_uid != info->uid && info->uid != 0) { + if(st.st_uid != info->uid && info->uid != 0) LOGE("su: Wrong permission of pts_slave"); - info->access.policy = DENY; - exit(1); - } // Set our pts_slave to devpts, same restriction as adb shell lsetfilecon(pts_slave, "u:object_r:devpts:s0");