[openssh-commits] [openssh] 03/06: upstream: save_errno wrappers inside two small signal handlers that

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Jun 28 08:36:25 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 b8793e2b0851f7d71b97554fa5260b23796d6277
Author: deraadt at openbsd.org <deraadt at openbsd.org>
AuthorDate: Wed Jun 26 23:14:14 2024 +0000

    upstream: save_errno wrappers inside two small signal handlers that
    
    perform system calls, for systems with libc that do perform libc sigtramps.
    ok djm markus
    
    OpenBSD-Commit-ID: 7749b56419a7c9dcfe4c6c04811e429813346c62
---
 scp.c  | 4 +++-
 sftp.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/scp.c b/scp.c
index 492dace1..0779c3c2 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.260 2023/10/11 05:42:08 djm Exp $ */
+/* $OpenBSD: scp.c,v 1.261 2024/06/26 23:14:14 deraadt Exp $ */
 /*
  * scp - secure remote copy.  This is basically patched BSD rcp which
  * uses ssh to do the data transfer (instead of using rcmd).
@@ -222,9 +222,11 @@ suspone(int pid, int signo)
 static void
 suspchild(int signo)
 {
+	int save_errno = errno;
 	suspone(do_cmd_pid, signo);
 	suspone(do_cmd_pid2, signo);
 	kill(getpid(), SIGSTOP);
+	errno = save_errno;
 }
 
 static int
diff --git a/sftp.c b/sftp.c
index c080fba5..360c5004 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.238 2024/04/30 06:16:55 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.239 2024/06/26 23:14:14 deraadt Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm at openbsd.org>
  *
@@ -234,12 +234,14 @@ killchild(int signo)
 static void
 suspchild(int signo)
 {
+	int save_errno = errno;
 	if (sshpid > 1) {
 		kill(sshpid, signo);
 		while (waitpid(sshpid, NULL, WUNTRACED) == -1 && errno == EINTR)
 			continue;
 	}
 	kill(getpid(), SIGSTOP);
+	errno = save_errno;
 }
 
 static void

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


More information about the openssh-commits mailing list