[openssh-commits] [openssh] 03/05: upstream: simplify

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Jun 7 05:54:40 AEST 2024


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit d7b2070bdaa4ebbfafb9975c1d5a62b73289d31f
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Thu Jun 6 19:47:48 2024 +0000

    upstream: simplify
    
    OpenBSD-Regress-ID: 50316e0d1ae0c0a057a45af042253e54ce23d11c
---
 regress/test-exec.sh | 48 +++++++++++++++++++++++-------------------------
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index 9e6d4c3c..c3d433d3 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
-#	$OpenBSD: test-exec.sh,v 1.112 2024/06/06 18:48:13 djm Exp $
+#	$OpenBSD: test-exec.sh,v 1.113 2024/06/06 19:47:48 djm Exp $
 #	Placed in the Public Domain.
 
 #SUDO=sudo
@@ -456,33 +456,31 @@ make_tmpdir ()
 
 stop_sshd ()
 {
-	if [ -f $PIDFILE ]; then
-		pid=`$SUDO cat $PIDFILE`
-		if [ "X$pid" = "X" ]; then
-			echo no sshd running
+	[ -f $PIDFILE ] || return
+	pid=`$SUDO cat $PIDFILE`
+	if [ "X$pid" = "X" ]; then
+		echo "no sshd running" 1>&2
+		return
+	elif [ $pid -lt 2 ]; then
+		echo "bad pid for sshd: $pid" 1>&2
+		return
+	fi
+	$SUDO kill $pid
+	trace "wait for sshd to exit"
+	i=0;
+	while [ -f $PIDFILE -a $i -lt 5 ]; do
+		i=`expr $i + 1`
+		sleep $i
+	done
+	if test -f $PIDFILE; then
+		if $SUDO kill -0 $pid; then
+			echo "sshd didn't exit port $PORT pid $pid" 1>&2
 		else
-			if [ $pid -lt 2 ]; then
-				echo bad pid for sshd: $pid
-			else
-				$SUDO kill $pid
-				trace "wait for sshd to exit"
-				i=0;
-				while [ -f $PIDFILE -a $i -lt 5 ]; do
-					i=`expr $i + 1`
-					sleep $i
-				done
-				if test -f $PIDFILE; then
-					if $SUDO kill -0 $pid; then
-						echo "sshd didn't exit " \
-						    "port $PORT pid $pid"
-					else
-						echo "sshd died without cleanup"
-					fi
-					exit 1
-				fi
-			fi
+			echo "sshd died without cleanup" 1>&2
 		fi
+		exit 1
 	fi
+	PIDFILE=""
 }
 
 # helper

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list