]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Add some fflushes to make it easier for piped programs to talk to
authorSimon Tatham <anakin@pobox.com>
Sat, 28 Apr 2001 08:42:06 +0000 (08:42 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 28 Apr 2001 08:42:06 +0000 (08:42 +0000)
plink and pscp

[originally from svn r1078]

plink.c
scp.c
ssh.c

diff --git a/plink.c b/plink.c
index 6eb9a788dec59cc66b8e26cf4257b43f87a957ea..d493c686790ac611b6f0373cb7a984e54544d220 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 2d0219147ff906c9c54b02fab654549bfc444dd1..ad3341333ecdd3f555625596869d70523a56e503 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 c47aebd13c04eea77288e1a7d8b81a19113cd881..fe9f515ca85771bf48bafd356606262114b051b4 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), \