diff options
author | Ron Yorston <rmy@pobox.com> | 2024-09-04 12:47:03 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-09-04 12:47:03 +0100 |
commit | cbfa58d56c3ca59538bf23e30105ce27ed5ef948 (patch) | |
tree | 29c88182b7ff243931d5956121e23cd877112b16 /libbb | |
parent | 13a2b505b3fd7abcb4b4516d6745df870d7aee64 (diff) | |
download | busybox-w32-cbfa58d56c3ca59538bf23e30105ce27ed5ef948.tar.gz busybox-w32-cbfa58d56c3ca59538bf23e30105ce27ed5ef948.tar.bz2 busybox-w32-cbfa58d56c3ca59538bf23e30105ce27ed5ef948.zip |
ash: optimise running of scripts (2)
Commit 4b7b4a960 (ash: optimise running of scripts) avoided creation
of a process when running a script. There's another case where we
can do the same: if the script is being run from a FS_SHELLEXEC
shell.
- Check the necessary conditions for this to happen.
- Allocate two extra slots in the argv array for FS_SHELLEXEC.
- Set the index of the script file in the argv array. Without this
the test 'pidof this' failed because the command name hadn't been
correctly set.
Adds 80-96 bytes.
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/appletlib.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 97dfb3df8..1ff7fe6c8 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -394,6 +394,13 @@ bool re_execed; | |||
394 | static int interp = 0; | 394 | static int interp = 0; |
395 | char bb_comm[COMM_LEN]; | 395 | char bb_comm[COMM_LEN]; |
396 | char bb_command_line[128]; | 396 | char bb_command_line[128]; |
397 | |||
398 | # if ENABLE_FEATURE_SH_STANDALONE | ||
399 | void FAST_FUNC set_interp(int i) | ||
400 | { | ||
401 | interp = i; | ||
402 | } | ||
403 | # endif | ||
397 | #endif | 404 | #endif |
398 | 405 | ||
399 | 406 | ||