diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2016-12-16 01:06:27 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2016-12-16 13:16:34 +1100 |
commit | 2f2ffa4fbe4b671bbffa0611f15ba44cff64d58e (patch) | |
tree | e23577a9aadfbaed15dccfcd289f74ac542d3397 /regress/test-exec.sh | |
parent | e15e7152331e3976b35475fd4e9c72897ad0f074 (diff) |
upstream commit
Move the "stop sshd" code into its own helper function.
Patch from Zev Weiss <zev at bewilderbeest.net>, ok djm@
Upstream-Regress-ID: a113dea77df5bd97fb4633ea31f3d72dbe356329
Diffstat (limited to 'regress/test-exec.sh')
-rw-r--r-- | regress/test-exec.sh | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh index 5d48706d4..bfa48803b 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: test-exec.sh,v 1.57 2016/11/25 03:02:01 dtucker Exp $ | 1 | # $OpenBSD: test-exec.sh,v 1.58 2016/12/16 01:06:27 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | #SUDO=sudo | 4 | #SUDO=sudo |
@@ -293,16 +293,8 @@ md5 () { | |||
293 | } | 293 | } |
294 | # End of portable specific functions | 294 | # End of portable specific functions |
295 | 295 | ||
296 | # helper | 296 | stop_sshd () |
297 | cleanup () | ||
298 | { | 297 | { |
299 | if [ "x$SSH_PID" != "x" ]; then | ||
300 | if [ $SSH_PID -lt 2 ]; then | ||
301 | echo bad pid for ssh: $SSH_PID | ||
302 | else | ||
303 | kill $SSH_PID | ||
304 | fi | ||
305 | fi | ||
306 | if [ -f $PIDFILE ]; then | 298 | if [ -f $PIDFILE ]; then |
307 | pid=`$SUDO cat $PIDFILE` | 299 | pid=`$SUDO cat $PIDFILE` |
308 | if [ "X$pid" = "X" ]; then | 300 | if [ "X$pid" = "X" ]; then |
@@ -325,6 +317,19 @@ cleanup () | |||
325 | fi | 317 | fi |
326 | } | 318 | } |
327 | 319 | ||
320 | # helper | ||
321 | cleanup () | ||
322 | { | ||
323 | if [ "x$SSH_PID" != "x" ]; then | ||
324 | if [ $SSH_PID -lt 2 ]; then | ||
325 | echo bad pid for ssh: $SSH_PID | ||
326 | else | ||
327 | kill $SSH_PID | ||
328 | fi | ||
329 | fi | ||
330 | stop_sshd | ||
331 | } | ||
332 | |||
328 | start_debug_log () | 333 | start_debug_log () |
329 | { | 334 | { |
330 | echo "trace: $@" >$TEST_REGRESS_LOGFILE | 335 | echo "trace: $@" >$TEST_REGRESS_LOGFILE |