diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-10-11 18:39:25 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-10-11 18:44:00 +0200 |
commit | 5acf5e1f870fb5382556d4b434158f7d497893ca (patch) | |
tree | 9200222f648afe4c743c119712e66e38d58e1713 /libbb/appletlib.c | |
parent | 23aba8a9a66637fbc6b1eed2a259cb7ddb1a1595 (diff) | |
download | busybox-w32-5acf5e1f870fb5382556d4b434158f7d497893ca.tar.gz busybox-w32-5acf5e1f870fb5382556d4b434158f7d497893ca.tar.bz2 busybox-w32-5acf5e1f870fb5382556d4b434158f7d497893ca.zip |
shell: fix script's comm field if ENABLE_FEATURE_PREFER_APPLETS=y
function old new delta
re_execed_comm - 46 +46
main 72 86 +14
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 60/0) Total: 60 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/appletlib.c')
-rw-r--r-- | libbb/appletlib.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index e8c308467..03389f541 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -1112,8 +1112,14 @@ int main(int argc UNUSED_PARAM, char **argv) | |||
1112 | || ENABLE_FEATURE_PREFER_APPLETS | 1112 | || ENABLE_FEATURE_PREFER_APPLETS |
1113 | || !BB_MMU | 1113 | || !BB_MMU |
1114 | ) { | 1114 | ) { |
1115 | if (NUM_APPLETS > 1) | 1115 | if (NUM_APPLETS > 1) { |
1116 | set_task_comm(applet_name); | 1116 | /* Careful, do not trash comm of "SCRIPT.sh" - |
1117 | * the case when started from e.g. #!/bin/ash script. | ||
1118 | * (not limited to shells - #!/bin/awk scripts also exist) | ||
1119 | */ | ||
1120 | if (re_execed_comm()) | ||
1121 | set_task_comm(applet_name); | ||
1122 | } | ||
1117 | } | 1123 | } |
1118 | 1124 | ||
1119 | parse_config_file(); /* ...maybe, if FEATURE_SUID_CONFIG */ | 1125 | parse_config_file(); /* ...maybe, if FEATURE_SUID_CONFIG */ |