[openssh-commits] [openssh] 01/01: upstream: Do not ignore SIGINT while waiting for input if editline(3)
git+noreply at mindrot.org
git+noreply at mindrot.org
Sat Sep 11 20:27: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 19b3d846f06697c85957ab79a63454f57f8e22d6
Author: schwarze at openbsd.org <schwarze at openbsd.org>
Date: Sat Sep 11 09:05:50 2021 +0000
upstream: Do not ignore SIGINT while waiting for input if editline(3)
is not used. Instead, in non-interactive mode, exit sftp(1), like for other
serious errors. As pointed out by dtucker@, when compiled without editline(3)
support in portable OpenSSH, the el == NULL branch is also used for
interactive mode. In that case, discard the input line and provide a fresh
prompt to the user just like in the case where editline(3) is used. OK djm@
OpenBSD-Commit-ID: 7d06f4d3ebba62115527fafacf38370d09dfb393
---
sftp.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/sftp.c b/sftp.c
index 69f84cdc..418f312f 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.211 2021/08/12 09:59:00 schwarze Exp $ */
+/* $OpenBSD: sftp.c,v 1.212 2021/09/11 09:05:50 schwarze Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm at openbsd.org>
*
@@ -2204,28 +2204,31 @@ interactive_loop(struct sftp_conn *conn, char *file1, char *file2)
interactive = !batchmode && isatty(STDIN_FILENO);
err = 0;
for (;;) {
+ struct sigaction sa;
+
+ interrupted = 0;
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = interactive ? read_interrupt : killchild;
+ if (sigaction(SIGINT, &sa, NULL) == -1) {
+ debug3("sigaction(%s): %s", strsignal(SIGINT),
+ strerror(errno));
+ break;
+ }
if (el == NULL) {
if (interactive)
printf("sftp> ");
if (fgets(cmd, sizeof(cmd), infile) == NULL) {
if (interactive)
printf("\n");
+ if (interrupted)
+ continue;
break;
}
} else {
#ifdef USE_LIBEDIT
const char *line;
int count = 0;
- struct sigaction sa;
- interrupted = 0;
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = read_interrupt;
- if (sigaction(SIGINT, &sa, NULL) == -1) {
- debug3("sigaction(%s): %s",
- strsignal(SIGINT), strerror(errno));
- break;
- }
if ((line = el_gets(el, &count)) == NULL ||
count <= 0) {
printf("\n");
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list