From f109038d127eaa518c5330cc075b47cc429bf225 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 13 Sep 2019 03:14:58 -0400 Subject: [PATCH] Hardcode shell uid to 2000 --- native/jni/utils/misc.cpp | 8 -------- native/jni/utils/misc.h | 3 +-- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/native/jni/utils/misc.cpp b/native/jni/utils/misc.cpp index 2d788b61b..9d680ce5d 100644 --- a/native/jni/utils/misc.cpp +++ b/native/jni/utils/misc.cpp @@ -17,14 +17,6 @@ #include #include -unsigned get_shell_uid() { - struct passwd* ppwd = getpwnam("shell"); - if (nullptr == ppwd) - return 2000; - - return ppwd->pw_uid; -} - int fork_dont_care() { int pid = xfork(); if (pid) { diff --git a/native/jni/utils/misc.h b/native/jni/utils/misc.h index 80188ba77..ad299a7b0 100644 --- a/native/jni/utils/misc.h +++ b/native/jni/utils/misc.h @@ -1,13 +1,12 @@ #pragma once -#define UID_SHELL (get_shell_uid()) #define UID_ROOT 0 +#define UID_SHELL 2000 #ifdef __cplusplus extern "C" { #endif -unsigned get_shell_uid(); int fork_dont_care(); int fork_no_zombie(); int strend(const char *s1, const char *s2);