diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2024-06-26 23:14:15 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2024-06-26 23:14:15 +0000 |
commit | 4e77a5592007b61d7f13df44a0630cc68dca07ca (patch) | |
tree | 3c7ac574ad6d615d1ef8bed6b0ea24b06715bcea /usr.bin/ssh | |
parent | ae34bd6ec9e9367612e04bf26d02c53fc0f5f512 (diff) |
save_errno wrappers inside two small signal handlers that perform
system calls, for systems with libc that do perform libc sigtramps.
ok djm markus
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/scp.c | 4 | ||||
-rw-r--r-- | usr.bin/ssh/sftp.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index e7c4da1ad3b..40b006a365d 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/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). @@ -194,9 +194,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/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c index 67b0fcfbf99..933e938c03a 100644 --- a/usr.bin/ssh/sftp.c +++ b/usr.bin/ssh/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@openbsd.org> * @@ -213,12 +213,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 |