diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-26 22:29:11 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-26 22:29:11 +0200 |
commit | 65a8b859a9a3f2bb4a62c15ca1f4d01288593734 (patch) | |
tree | 11965425b70a8cb6f40a7ad1d4d64e730be313bb /scripts/memusage | |
parent | 0e081d01a8ae37df11af612eb65d858c1c0f28be (diff) | |
download | busybox-65a8b859a9a3f2bb4a62c15ca1f4d01288593734.tar.gz |
ash: optimize tryexec(): avoid one allocation
There was a bug in tryexec which bbox had fixed in 2003.
dash had a smaller fix in 2007. Copy it. It is smaller,
although it is also more quirky (requires argv[-1] to exist).
Upstream commit 1:
Date: Mon, 15 Oct 2007 20:24:28 +0800
[EXEC] Fixed execing of scripts with no hash-bang
The function tryexec used the original name instead of the path found through
PATH search. This patch fixes that.
Test case:
trap 'rm -f $TMP' EXIT
TMP=$(tempfile -s nosuchthing)
cat <<- EOF > $TMP
echo OK
EOF
chmod u+x $TMP
cd /
PATH=${TMP%/*} ${TMP##*/}
Old result:
/bin/sh: Can't open filelgY4Fanosuchthing
New result:
OK
Upstream commit 2:
Date: Sun, 23 Dec 2007 11:02:26 +0800
[EVAL] Fix bad pointer arithmetic in evalcommand
dash dies on sparc with a SIGBUS due to an arithmetic error introduced
with commit 03b4958, this patch fixes it.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
function old new delta
evalcommand 1261 1264 +3
dotcmd 321 319 -2
tryexec 115 64 -51
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 3/-53) Total: -50 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'scripts/memusage')
0 files changed, 0 insertions, 0 deletions