[openssh-commits] [openssh] 04/08: upstream: on fatal errors, make scp wait for ssh connection before

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Aug 10 12:48:02 AEST 2021


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

djm pushed a commit to branch master
in repository openssh.

commit b4b3f3da6cdceb3fd168b5fab69d11fba73bd0ae
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Mon Aug 9 07:21:01 2021 +0000

    upstream: on fatal errors, make scp wait for ssh connection before
    
    exiting avoids LogLevel=verbose (or greater) messages from ssh appearing
    after scp has returned exited and control has returned to the shell; ok
    markus@
    
    (this was originally committed as r1.223 along with unrelated stuff that
    I rolled back in r1.224)
    
    OpenBSD-Commit-ID: 1261fd667ad918484889ed3d7aec074f3956a74b
---
 scp.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/scp.c b/scp.c
index 894f4c8e..21467c46 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.224 2021/08/09 07:19:12 djm Exp $ */
+/* $OpenBSD: scp.c,v 1.225 2021/08/09 07:21:01 djm Exp $ */
 /*
  * scp - secure remote copy.  This is basically patched BSD rcp which
  * uses ssh to do the data transfer (instead of using rcmd).
@@ -2141,3 +2141,21 @@ lostconn(int signo)
 	else
 		exit(1);
 }
+
+void
+cleanup_exit(int i)
+{
+	if (remin > 0)
+		close(remin);
+	if (remout > 0)
+		close(remout);
+	if (remin2 > 0)
+		close(remin2);
+	if (remout2 > 0)
+		close(remout2);
+	if (do_cmd_pid > 0)
+		waitpid(do_cmd_pid, NULL, 0);
+	if (do_cmd_pid2 > 0)
+		waitpid(do_cmd_pid2, NULL, 0);
+	exit(i);
+}

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


More information about the openssh-commits mailing list