]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - bin/sh/tests/builtins/exec2.0
MFC r297360: sh: Fix use-after-free if a trap replaces itself.
[FreeBSD/stable/10.git] / bin / sh / tests / builtins / exec2.0
1 # $FreeBSD$
2
3 failures=
4 failure() {
5         echo "Error at line $1" >&2
6         failures=x$failures
7 }
8
9 (
10         exec -- >/dev/null
11         echo bad
12 )
13 [ $? = 0 ] || failure $LINENO
14 (
15         exec -- ${SH} -c 'exit 42'
16         echo bad
17 )
18 [ $? = 42 ] || failure $LINENO
19 (
20         exec -- /var/empty/nosuch
21         echo bad
22 ) 2>/dev/null
23 [ $? = 127 ] || failure $LINENO
24
25 test -z "$failures"