• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

external/koush/Superuser


Commit MetaInfo

Revisiona43f033dc9a1472821e57aab76b67b76263c99c4 (tree)
Time2013-11-30 02:17:57
AuthorKoushik Dutta <koushd@gmai...>
CommiterKoushik Dutta

Log Message

Merge remote-tracking branch 'cern/multiuser-regression-v1' into cm-11.0

Conflicts:
Superuser/jni/su/su.c

Change-Id: I2474f5048e590592e1baa7f4bb1caf76e1245b74

Change Summary

Incremental Difference

--- a/Superuser/jni/su/su.c
+++ b/Superuser/jni/su/su.c
@@ -607,6 +607,28 @@ static int get_api_version() {
607607 return ver;
608608 }
609609
610+static void fork_for_samsung(void)
611+{
612+ // Samsung CONFIG_SEC_RESTRICT_SETUID wants the parent process to have
613+ // EUID 0, or else our setresuid() calls will be denied. So make sure
614+ // all such syscalls are executed by a child process.
615+ int rv;
616+
617+ switch (fork()) {
618+ case 0:
619+ return;
620+ case -1:
621+ PLOGE("fork");
622+ exit(1);
623+ default:
624+ if (wait(&rv) < 0) {
625+ exit(1);
626+ } else {
627+ exit(WEXITSTATUS(rv));
628+ }
629+ }
630+}
631+
610632 int main(int argc, char *argv[]) {
611633 return su_main(argc, argv, 1);
612634 }
@@ -617,6 +639,8 @@ int su_main(int argc, char *argv[], int need_client) {
617639 return run_daemon();
618640 }
619641
642+ fork_for_samsung();
643+
620644 // Sanitize all secure environment variables (from linker_environ.c in AOSP linker).
621645 /* The same list than GLibc at this point */
622646 static const char* const unsec_vars[] = {