File openssh-7.2p2-sftp_print_diagnostic_messages.patch of Package openssh.29886

From 3ce60840afab45ddb742b260a867dcc8b2975a2f Mon Sep 17 00:00:00 2001
From: Old openssh patches <pcerny@suse.com>
Date: Wed, 26 Oct 2022 09:58:14 +0200
Subject: [PATCH] openssh-7.2p2-sftp_print_diagnostic_messages

# HG changeset patch
# Parent  738c056a50c7d813e54800ce37f15568f0e45340
Put back sftp client diagnostic messages in batch mode

bsc#1023275
---
 sftp.0 | 3 +++
 sftp.1 | 3 +++
 sftp.c | 9 ++++++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/sftp.0 b/sftp.0
index ce48de9c..887c5e29 100644
--- a/sftp.0
+++ b/sftp.0
@@ -167,6 +167,9 @@ DESCRIPTION
      -p      Preserves modification times, access times, and modes from the
              original files transferred.
 
+     -Q      Not-so-quiet batch mode: forces printing of diagnostic messages
+             in batch mode.
+
      -q      Quiet mode: disables the progress meter as well as warning and
              diagnostic messages from ssh(1).
 
diff --git a/sftp.1 b/sftp.1
index edc5a85e..41f6795c 100644
--- a/sftp.1
+++ b/sftp.1
@@ -256,6 +256,9 @@ Specifies the port to connect to on the remote host.
 .It Fl p
 Preserves modification times, access times, and modes from the
 original files transferred.
+.It Fl Q
+Not-so-quiet batch mode: forces printing of diagnostic messages
+in batch mode.
 .It Fl q
 Quiet mode: disables the progress meter as well as warning and
 diagnostic messages from
diff --git a/sftp.c b/sftp.c
index 09d06671..82c9eac5 100644
--- a/sftp.c
+++ b/sftp.c
@@ -84,6 +84,8 @@ static pid_t sshpid = -1;
 
 /* Suppress diagnositic messages */
 int quiet = 0;
+/* Force diagnositic messages in batch mode */
+int loud = 0;
 
 /* This is set to 0 if the progressmeter is not desired. */
 int showprogress = 1;
@@ -2268,7 +2270,7 @@ main(int argc, char **argv)
 	infile = stdin;
 
 	while ((ch = getopt(argc, argv,
-	    "1246afhpqrvCc:D:i:l:o:s:S:b:B:F:P:R:")) != -1) {
+	    "1246afhpQqrvCc:D:i:l:o:s:S:b:B:F:P:R:")) != -1) {
 		switch (ch) {
 		/* Passed through to ssh(1) */
 		case '4':
@@ -2284,6 +2286,9 @@ main(int argc, char **argv)
 			addargs(&args, "-%c", ch);
 			addargs(&args, "%s", optarg);
 			break;
+		case 'Q':
+			loud = 1;
+			break;
 		case 'q':
 			ll = SYSLOG_LEVEL_ERROR;
 			quiet = 1;
@@ -2365,6 +2370,8 @@ main(int argc, char **argv)
 			usage();
 		}
 	}
+	if (batchmode && loud)
+		quiet = 0;
 
 	if (!isatty(STDERR_FILENO))
 		showprogress = 0;
-- 
2.38.0

openSUSE Build Service is sponsored by