]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
prefer ln to cp for temporary copy of sshd
authorDamien Miller <djm@mindrot.org>
Thu, 14 May 2020 02:22:09 +0000 (12:22 +1000)
committerDamien Miller <djm@mindrot.org>
Thu, 14 May 2020 02:24:24 +0000 (12:24 +1000)
I saw failures on the reexec fallback test on Darwin 19.4 where
fork()ed children of a process that had it's executable removed
would instantly fail. Using ln to preserve the inode avoids this.

regress/reexec.sh

index 2192456cd85e159e950c41a6acf4d513834bc8f6..8966ba524e6004154835d97c6033f77e1672b568 100644 (file)
@@ -9,7 +9,10 @@ SSHD_COPY=$OBJ/sshd
 # Start a sshd and then delete it
 start_sshd_copy ()
 {
-       cp $SSHD_ORIG $SSHD_COPY
+       # NB. prefer ln to cp here. On some OSX 19.4 configurations,
+       # djm has seen failure after fork() when the executable image
+       # has been removed from the filesystem.
+       ln $SSHD_ORIG $SSHD_COPY || cp $SSHD_ORIG $SSHD_COPY
        SSHD=$SSHD_COPY
        start_sshd
        SSHD=$SSHD_ORIG