Add some fflushes to make it easier for piped programs to talk to
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sat, 28 Apr 2001 08:42:06 +0000 (08:42 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sat, 28 Apr 2001 08:42:06 +0000 (08:42 +0000)
plink and pscp

git-svn-id: svn://svn.tartarus.org/sgt/putty@1078 cda61777-01e9-0310-a592-d414129be87e

plink.c
scp.c
ssh.c

diff --git a/plink.c b/plink.c
index 6eb9a78..d493c68 100644 (file)
--- 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 2d02191..ad33413 100644 (file)
--- 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 c47aebd..fe9f515 100644 (file)
--- 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), \