Only try to chmod logfile if we have sudo. If we don't have sudo
authordtucker <dtucker@openbsd.org>
Tue, 31 Oct 2023 02:58:45 +0000 (02:58 +0000)
committerdtucker <dtucker@openbsd.org>
Tue, 31 Oct 2023 02:58:45 +0000 (02:58 +0000)
then we won't need to chmod.

regress/usr.bin/ssh/test-exec.sh

index acb454c..f735479 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: test-exec.sh,v 1.103 2023/10/30 23:00:25 djm Exp $
+#      $OpenBSD: test-exec.sh,v 1.104 2023/10/31 02:58:45 dtucker Exp $
 #      Placed in the Public Domain.
 
 #SUDO=sudo
@@ -217,7 +217,7 @@ timestamp="\`$OBJ/timestamp\`"
 logfile="${TEST_SSH_LOGDIR}/\${timestamp}.sshd.\$\$.log"
 rm -f $TEST_SSHD_LOGFILE
 touch \$logfile
-chown $USER \$logfile
+test -z "$SUDO" || "$SUDO" chown $USER \$logfile
 ln -f -s \${logfile} $TEST_SSHD_LOGFILE
 echo "Executing: ${SSHD} \$@" log \${logfile} >>$TEST_REGRESS_LOGFILE
 echo "Executing: ${SSHD} \$@" >>\${logfile}