diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2024-10-07 06:36:00 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2024-10-07 06:36:00 +0200 |
commit | 4c1d645c86f4e7a380d96f9ba962f8b270f595dc (patch) | |
tree | 365585f77fc146545119c17250eff32a61f2718c /shell/ash.c | |
parent | 860b3d066f6aaa12dfa0cd2351559e05288cf9b5 (diff) | |
download | busybox-w32-4c1d645c86f4e7a380d96f9ba962f8b270f595dc.tar.gz busybox-w32-4c1d645c86f4e7a380d96f9ba962f8b270f595dc.tar.bz2 busybox-w32-4c1d645c86f4e7a380d96f9ba962f8b270f595dc.zip |
libbb: simplify parameter passing in is_in_supplementary_groups()
function old new delta
is_in_supplementary_groups 54 52 -2
nexpr 721 718 -3
test_exec 125 119 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-11) Total: -11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/shell/ash.c b/shell/ash.c index 984a71f07..fa57511a7 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -493,8 +493,7 @@ struct globals_misc { | |||
493 | /* Rarely referenced stuff */ | 493 | /* Rarely referenced stuff */ |
494 | 494 | ||
495 | /* Cached supplementary group array (for testing executable'ity of files) */ | 495 | /* Cached supplementary group array (for testing executable'ity of files) */ |
496 | int ngroups; | 496 | struct cached_groupinfo groupinfo; |
497 | gid_t *group_array; | ||
498 | 497 | ||
499 | #if ENABLE_ASH_RANDOM_SUPPORT | 498 | #if ENABLE_ASH_RANDOM_SUPPORT |
500 | random_t random_gen; | 499 | random_t random_gen; |
@@ -528,8 +527,7 @@ extern struct globals_misc *BB_GLOBAL_CONST ash_ptr_to_globals_misc; | |||
528 | #define may_have_traps (G_misc.may_have_traps ) | 527 | #define may_have_traps (G_misc.may_have_traps ) |
529 | #define trap (G_misc.trap ) | 528 | #define trap (G_misc.trap ) |
530 | #define trap_ptr (G_misc.trap_ptr ) | 529 | #define trap_ptr (G_misc.trap_ptr ) |
531 | #define ngroups (G_misc.ngroups ) | 530 | #define groupinfo (G_misc.groupinfo ) |
532 | #define group_array (G_misc.group_array) | ||
533 | #define random_gen (G_misc.random_gen ) | 531 | #define random_gen (G_misc.random_gen ) |
534 | #define backgndpid (G_misc.backgndpid ) | 532 | #define backgndpid (G_misc.backgndpid ) |
535 | #define INIT_G_misc() do { \ | 533 | #define INIT_G_misc() do { \ |
@@ -13821,7 +13819,7 @@ static int test_exec(/*const char *fullname,*/ struct stat *statb) | |||
13821 | stmode = S_IXUSR; | 13819 | stmode = S_IXUSR; |
13822 | else if (statb->st_gid == getegid()) | 13820 | else if (statb->st_gid == getegid()) |
13823 | stmode = S_IXGRP; | 13821 | stmode = S_IXGRP; |
13824 | else if (is_in_supplementary_groups(&ngroups, &group_array, statb->st_gid)) | 13822 | else if (is_in_supplementary_groups(&groupinfo, statb->st_gid)) |
13825 | stmode = S_IXGRP; | 13823 | stmode = S_IXGRP; |
13826 | 13824 | ||
13827 | return statb->st_mode & stmode; | 13825 | return statb->st_mode & stmode; |