[openssh-commits] [openssh] 01/01: upstream: Since the previous commit, ssh regress test sftp-chroot was
git+noreply at mindrot.org
git+noreply at mindrot.org
Fri May 11 13:10:58 AEST 2018
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit e7751aa4094d51a9bc00778aa8d07e22934c55ee
Author: bluhm at openbsd.org <bluhm at openbsd.org>
Date: Thu Apr 26 14:47:03 2018 +0000
upstream: Since the previous commit, ssh regress test sftp-chroot was
failing. The sftp program terminated with the wrong exit code as sftp called
fatal() instad of exit(0). So when the sigchld handler waits for the child,
remember that it was found. Then don't expect that main() can wait again. OK
dtucker@
OpenBSD-Commit-ID: bfafd940c0de5297940c71ddf362053db0232266
---
sftp.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sftp.c b/sftp.c
index da81897e..d068f7e0 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.184 2018/04/13 05:04:12 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.185 2018/04/26 14:47:03 bluhm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm at openbsd.org>
*
@@ -81,7 +81,7 @@ FILE* infile;
int batchmode = 0;
/* PID of ssh transport process */
-static pid_t sshpid = -1;
+static volatile pid_t sshpid = -1;
/* Suppress diagnositic messages */
int quiet = 0;
@@ -264,8 +264,10 @@ sigchld_handler(int sig)
/* Report if ssh transport process dies. */
while ((pid = waitpid(sshpid, NULL, WNOHANG)) == -1 && errno == EINTR)
continue;
- if (pid == sshpid)
+ if (pid == sshpid) {
(void)write(STDERR_FILENO, msg, sizeof(msg) - 1);
+ sshpid = -1;
+ }
errno = save_errno;
}
@@ -2554,7 +2556,7 @@ main(int argc, char **argv)
if (batchmode)
fclose(infile);
- while (waitpid(sshpid, NULL, 0) == -1)
+ while (waitpid(sshpid, NULL, 0) == -1 && sshpid > 1)
if (errno != EINTR)
fatal("Couldn't wait for ssh process: %s",
strerror(errno));
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list