From b4453f4964de4b98d42e38df8a8848b1c63e10e9 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 28 Apr 2001 08:42:06 +0000 Subject: [PATCH] Add some fflushes to make it easier for piped programs to talk to plink and pscp git-svn-id: svn://svn.tartarus.org/sgt/putty@1078 cda61777-01e9-0310-a592-d414129be87e --- plink.c | 8 ++++++-- scp.c | 2 ++ ssh.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plink.c b/plink.c index 6eb9a788..d493c686 100644 --- a/plink.c +++ b/plink.c @@ -88,10 +88,14 @@ void verify_ssh_host_key(char *host, int port, char *keytype, if (ret == 0) /* success - key matched OK */ return; - if (ret == 2) /* key was different */ + if (ret == 2) { /* key was different */ fprintf(stderr, wrongmsg, fingerprint); - if (ret == 1) /* key was absent */ + fflush(stderr); + } + if (ret == 1) { /* key was absent */ fprintf(stderr, absentmsg, fingerprint); + fflush(stderr); + } hin = GetStdHandle(STD_INPUT_HANDLE); GetConsoleMode(hin, &savemode); diff --git a/scp.c b/scp.c index 2d021914..ad334133 100644 --- a/scp.c +++ b/scp.c @@ -134,12 +134,14 @@ void verify_ssh_host_key(char *host, int port, char *keytype, return; if (ret == 2) { /* key was different */ fprintf(stderr, wrongmsg, fingerprint); + fflush(stderr); if (fgets(line, sizeof(line), stdin) && line[0] != '\0' && line[0] != '\n') { if (line[0] == 'y' || line[0] == 'Y') store_host_key(host, port, keytype, keystr); } else { fprintf(stderr, abandoned); + fflush(stderr); exit(0); } } diff --git a/ssh.c b/ssh.c index c47aebd1..fe9f515c 100644 --- a/ssh.c +++ b/ssh.c @@ -17,7 +17,7 @@ #define logevent(s) { logevent(s); \ if ((flags & FLAG_STDERR) && (flags & FLAG_VERBOSE)) \ - fprintf(stderr, "%s\n", s); } + { fprintf(stderr, "%s\n", s); fflush(stderr); } } #define bombout(msg) ( ssh_state = SSH_STATE_CLOSED, \ (s ? sk_close(s), s = NULL : 0), \ -- 2.11.0