diff options
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c index a6bb9894c..9173b8608 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -536,6 +536,8 @@ extern struct globals_misc *BB_GLOBAL_CONST ash_ptr_to_globals_misc; | |||
536 | curdir = nullstr; \ | 536 | curdir = nullstr; \ |
537 | physdir = nullstr; \ | 537 | physdir = nullstr; \ |
538 | trap_ptr = trap; \ | 538 | trap_ptr = trap; \ |
539 | groupinfo.euid = -1; \ | ||
540 | groupinfo.egid = -1; \ | ||
539 | } while (0) | 541 | } while (0) |
540 | 542 | ||
541 | 543 | ||
@@ -2319,7 +2321,7 @@ initvar(void) | |||
2319 | #if ENABLE_FEATURE_EDITING && ENABLE_FEATURE_EDITING_FANCY_PROMPT | 2321 | #if ENABLE_FEATURE_EDITING && ENABLE_FEATURE_EDITING_FANCY_PROMPT |
2320 | vps1.var_text = "PS1=\\w \\$ "; | 2322 | vps1.var_text = "PS1=\\w \\$ "; |
2321 | #else | 2323 | #else |
2322 | if (!geteuid()) | 2324 | if (!get_cached_euid(&groupinfo.euid)); |
2323 | vps1.var_text = "PS1=# "; | 2325 | vps1.var_text = "PS1=# "; |
2324 | #endif | 2326 | #endif |
2325 | vp = varinit; | 2327 | vp = varinit; |
@@ -13809,14 +13811,13 @@ static int test_exec(/*const char *fullname,*/ struct stat *statb) | |||
13809 | 13811 | ||
13810 | /* Executability depends on our euid/egid/supplementary groups */ | 13812 | /* Executability depends on our euid/egid/supplementary groups */ |
13811 | stmode = S_IXOTH; | 13813 | stmode = S_IXOTH; |
13812 | euid = geteuid(); | 13814 | euid = get_cached_euid(&groupinfo.euid); |
13813 | //TODO: cache euid? | ||
13814 | if (euid == 0) | 13815 | if (euid == 0) |
13815 | /* for root user, any X bit is good enough */ | 13816 | /* for root user, any X bit is good enough */ |
13816 | stmode = ANY_IX; | 13817 | stmode = ANY_IX; |
13817 | else if (statb->st_uid == euid) | 13818 | else if (statb->st_uid == euid) |
13818 | stmode = S_IXUSR; | 13819 | stmode = S_IXUSR; |
13819 | else if (statb->st_gid == getegid()) | 13820 | else if (statb->st_gid == get_cached_egid(&groupinfo.egid)) |
13820 | stmode = S_IXGRP; | 13821 | stmode = S_IXGRP; |
13821 | else if (is_in_supplementary_groups(&groupinfo, statb->st_gid)) | 13822 | else if (is_in_supplementary_groups(&groupinfo, statb->st_gid)) |
13822 | stmode = S_IXGRP; | 13823 | stmode = S_IXGRP; |