aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2024-10-09 08:22:14 +0100
committerRon Yorston <rmy@pobox.com>2024-10-09 08:22:14 +0100
commit9b181bf263b9d7c71b347542d945fe2467a495c6 (patch)
treefdfeab7574cde32d9b0a52a79d882dc4bf63710b
parentded78ca2656fd41f130d65345b0eb4d39b1fcbdf (diff)
downloadbusybox-w32-9b181bf263b9d7c71b347542d945fe2467a495c6.tar.gz
busybox-w32-9b181bf263b9d7c71b347542d945fe2467a495c6.tar.bz2
busybox-w32-9b181bf263b9d7c71b347542d945fe2467a495c6.zip
test: code shrink supplementary groups
Since we don't use is_in_supplementary_groups() there's no need for the cached_groupinfo structure to include the members required for its support or for them to be initialised. Saves 32 bytes.
-rw-r--r--coreutils/test.c4
-rw-r--r--include/libbb.h4
2 files changed, 8 insertions, 0 deletions
diff --git a/coreutils/test.c b/coreutils/test.c
index b63e33cc0..3d38ead00 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -1022,10 +1022,14 @@ int test_main(int argc, char **argv)
1022 1022
1023 info.euid = -1; 1023 info.euid = -1;
1024 info.egid = -1; 1024 info.egid = -1;
1025#if !ENABLE_PLATFORM_MINGW32
1025 info.ngroups = 0; 1026 info.ngroups = 0;
1026 info.supplementary_array = NULL; 1027 info.supplementary_array = NULL;
1028#endif
1027 r = test_main2(&info, argc, argv); 1029 r = test_main2(&info, argc, argv);
1030#if !ENABLE_PLATFORM_MINGW32
1028 free(info.supplementary_array); 1031 free(info.supplementary_array);
1032#endif
1029 1033
1030 return r; 1034 return r;
1031} 1035}
diff --git a/include/libbb.h b/include/libbb.h
index ed8892562..bc1453e12 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1268,8 +1268,12 @@ gid_t *bb_getgroups(int *ngroups, gid_t *group_array) FAST_FUNC;
1268struct cached_groupinfo { 1268struct cached_groupinfo {
1269 uid_t euid; 1269 uid_t euid;
1270 gid_t egid; 1270 gid_t egid;
1271#if !ENABLE_PLATFORM_MINGW32
1272 // If these are ever restored on Windows it will be necessary to alter
1273 // globals_misc_size()/globals_misc_copy() in ash.
1271 int ngroups; 1274 int ngroups;
1272 gid_t *supplementary_array; 1275 gid_t *supplementary_array;
1276#endif
1273}; 1277};
1274uid_t FAST_FUNC get_cached_euid(uid_t *euid); 1278uid_t FAST_FUNC get_cached_euid(uid_t *euid);
1275gid_t FAST_FUNC get_cached_egid(gid_t *egid); 1279gid_t FAST_FUNC get_cached_egid(gid_t *egid);