+static void fork_for_samsung(void)
+{
+ // Samsung CONFIG_SEC_RESTRICT_SETUID wants the parent process to have
+ // EUID 0, or else our setresuid() calls will be denied. So make sure
+ // all such syscalls are executed by a child process.
+ int rv;
+
+ switch (fork()) {
+ case 0:
+ return;
+ case -1:
+ PLOGE("fork");
+ exit(1);
+ default:
+ if (wait(&rv) < 0) {
+ exit(1);
+ } else {
+ exit(WEXITSTATUS(rv));
+ }
+ }
+}
+