Module Name:    src
Committed By:   pooka
Date:           Fri Feb 11 13:19:46 UTC 2011

Modified Files:
        src/tests/fs/psshfs: sshd_config.in t_psshfs.sh

Log Message:
Use sshd's pidfile instead of $! and wait for the pidfile to appear.
This plugs a race condition where sshd did not have a chance to
open a sucket before we attempted to connect to it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/psshfs/sshd_config.in
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/psshfs/t_psshfs.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/psshfs/sshd_config.in
diff -u src/tests/fs/psshfs/sshd_config.in:1.1 src/tests/fs/psshfs/sshd_config.in:1.2
--- src/tests/fs/psshfs/sshd_config.in:1.1	Tue Jul  6 14:06:22 2010
+++ src/tests/fs/psshfs/sshd_config.in	Fri Feb 11 13:19:46 2011
@@ -1,4 +1,4 @@
-# $NetBSD: sshd_config.in,v 1.1 2010/07/06 14:06:22 pooka Exp $
+# $NetBSD: sshd_config.in,v 1.2 2011/02/11 13:19:46 pooka Exp $
 
 # Basic settings.
 Port 10000
@@ -20,7 +20,7 @@
 StrictModes no
 
 # Some settings to allow user runs of sshd.
-PidFile @WORKDIR@/sshd.pid.2
+PidFile @WORKDIR@/sshd.pid
 Subsystem sftp @WORKDIR@/sftp-server
 UsePam no
 UsePrivilegeSeparation no

Index: src/tests/fs/psshfs/t_psshfs.sh
diff -u src/tests/fs/psshfs/t_psshfs.sh:1.3 src/tests/fs/psshfs/t_psshfs.sh:1.4
--- src/tests/fs/psshfs/t_psshfs.sh:1.3	Thu Jan  6 07:28:32 2011
+++ src/tests/fs/psshfs/t_psshfs.sh	Fri Feb 11 13:19:46 2011
@@ -1,4 +1,4 @@
-# $NetBSD: t_psshfs.sh,v 1.3 2011/01/06 07:28:32 pooka Exp $
+# $NetBSD: t_psshfs.sh,v 1.4 2011/02/11 13:19:46 pooka Exp $
 #
 # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -80,8 +80,10 @@
 	atf_check -s eq:0 -o empty -e empty chmod 400 ssh_host_key
 	atf_check -s eq:0 -o empty -e empty chmod 444 ssh_host_key.pub
 
-	/usr/sbin/sshd -e -D -f ./sshd_config >sshd.log 2>&1 &
-	echo $! >sshd.pid
+	/usr/sbin/sshd -e -f ./sshd_config >sshd.log 2>&1 &
+	while [ ! -f sshd.pid ]; do
+		sleep 0.01
+	done
 	echo "SSH server started (pid $(cat sshd.pid))"
 
 	echo "Setting up SSH client configuration"

Reply via email to