diff options
author | Tim Rice <tim@multitalents.net> | 2014-01-28 10:26:25 -0800 |
---|---|---|
committer | Tim Rice <tim@multitalents.net> | 2014-01-28 10:26:25 -0800 |
commit | 6f917ad376481995ab7d29fb53b08ec8d507eb9e (patch) | |
tree | 28b8e366f294cb729598cdb826f626682be73a9b /regress | |
parent | ab16ef4152914d44ce6f76e48167d26d22f66a06 (diff) | |
download | openssh-git-6f917ad376481995ab7d29fb53b08ec8d507eb9e.tar.gz |
- (tim) [regress/agent.sh regress/agent-ptrace.sh] Assign $? to a variable
when used as an error message inside an if statement so we display the
correct into. agent.sh patch from Petr Lautrbach.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/agent-ptrace.sh | 5 | ||||
-rw-r--r-- | regress/agent.sh | 30 |
2 files changed, 21 insertions, 14 deletions
diff --git a/regress/agent-ptrace.sh b/regress/agent-ptrace.sh index 6824b814..ae150641 100644 --- a/regress/agent-ptrace.sh +++ b/regress/agent-ptrace.sh @@ -45,8 +45,9 @@ else gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF quit EOF - if [ $? -ne 0 ]; then - fail "gdb failed: exit code $?" + r=$? + if [ $r -ne 0 ]; then + fail "gdb failed: exit code $r" fi egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace.*Permission denied.|procfs:.*: Invalid argument.|Unable to access task ' >/dev/null ${OBJ}/gdb.out r=$? diff --git a/regress/agent.sh b/regress/agent.sh index 90bad15d..cf1a45fe 100644 --- a/regress/agent.sh +++ b/regress/agent.sh @@ -34,40 +34,46 @@ else fi done ${SSHADD} -l > /dev/null 2>&1 - if [ $? -ne 0 ]; then - fail "ssh-add -l failed: exit code $?" + r=$? + if [ $r -ne 0 ]; then + fail "ssh-add -l failed: exit code $r" fi # the same for full pubkey output ${SSHADD} -L > /dev/null 2>&1 - if [ $? -ne 0 ]; then - fail "ssh-add -L failed: exit code $?" + r=$? + if [ $r -ne 0 ]; then + fail "ssh-add -L failed: exit code $r" fi trace "simple connect via agent" for p in 1 2; do ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p - if [ $? -ne 5$p ]; then - fail "ssh connect with protocol $p failed (exit code $?)" + r=$? + if [ $r -ne 5$p ]; then + fail "ssh connect with protocol $p failed (exit code $r)" fi done trace "agent forwarding" for p in 1 2; do ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1 - if [ $? -ne 0 ]; then - fail "ssh-add -l via agent fwd proto $p failed (exit code $?)" + r=$? + if [ $r -ne 0 ]; then + fail "ssh-add -l via agent fwd proto $p failed (exit code $r)" fi ${SSH} -A -$p -F $OBJ/ssh_proxy somehost \ "${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p" - if [ $? -ne 5$p ]; then - fail "agent fwd proto $p failed (exit code $?)" + r=$? + if [ $r -ne 5$p ]; then + fail "agent fwd proto $p failed (exit code $r)" fi done trace "delete all agent keys" ${SSHADD} -D > /dev/null 2>&1 - if [ $? -ne 0 ]; then - fail "ssh-add -D failed: exit code $?" + r=$? + if [ $r -ne 0 ]; then + fail "ssh-add -D failed: exit code $r" fi trace "kill agent" |