aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-03-11 10:35:38 -0400
committerMike Frysinger <vapier@gentoo.org>2009-03-11 10:43:43 -0400
commit5071f86083ca028e86500ec2459894e57245ad05 (patch)
tree5e3b335f2562213e0417c8e2068842e38c6d4c47 /tests/script-4.sh
parentlibsandbox: dump exec QA static notice to /dev/tty (diff)
downloadsandbox-5071f86083ca028e86500ec2459894e57245ad05.tar.gz
sandbox-5071f86083ca028e86500ec2459894e57245ad05.tar.bz2
sandbox-5071f86083ca028e86500ec2459894e57245ad05.zip
libsandbox: add more exec wrappers
While the execvp() is a common entry point, the other ones are often used as well. While they don't take environ pointers directly, the env could have been modified before calling the exec function, which means we need to restore our LD_PRELOAD setting. So now we support execv/execve/fexecve/popen/system. Missing from this list are the execl* funcs, but that's because they aren't exactly easy to interpose with the structure of their variable arguments. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'tests/script-4.sh')
-rwxr-xr-xtests/script-4.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/script-4.sh b/tests/script-4.sh
new file mode 100755
index 0000000..a5f0755
--- /dev/null
+++ b/tests/script-4.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+# make sure LD_PRELOAD makes it back into env on exec
+
+checkit() {
+ if ! eval "$@" | grep -q '^LD_PRELOAD=.*libsandbox.so.*' ; then
+ echo "LD_PRELOAD was not reset when running:"
+ echo " $*"
+ exit 1
+ fi
+}
+
+checkit "env -uLD_PRELOAD env"
+checkit "(unset LD_PRELOAD; env)"
+checkit "env LD_PRELOAD= env"
+checkit "env LD_PRELOAD=libc.so env"
+exit 0