shithub: riscv

Download patch

ref: 06abb1098a90a344d2aabfb486f56b8c5aada342
parent: f12f773944dd15f32dbe41b016fd1df34463069b
author: cinap_lenrek <[email protected]>
date: Fri Oct 12 15:28:39 EDT 2018

ssh: fix spinning due to sticky intr flag on connection timeout

--- a/sys/src/cmd/ssh.c
+++ b/sys/src/cmd/ssh.c
@@ -110,8 +110,6 @@
 	char err[ERRMAX];
 	int r;
 
-	if(intr)
-		return 1;
 	memset(err, 0, sizeof(err));
 	errstr(err, sizeof(err));
 	r = strcmp(err, "interrupted") == 0;
@@ -1331,25 +1329,25 @@
 		qlock(&sl);
 		if(send.eof)
 			break;
-		if(n < 0 && wasintr()){
+		if(n < 0 && wasintr())
+			intr = 1;
+		if(intr){
 			if(!raw) break;
-			if(intr){
-				getdim();
-				sendpkt("busbuuuu", MSG_CHANNEL_REQUEST,
-					send.chan,
-					"window-change", 13,
-					0,
-					tty.cols,
-					tty.lines,
-					tty.xpixels,
-					tty.ypixels);
-				sendpkt("busbs", MSG_CHANNEL_REQUEST,
-					send.chan,
-					"signal", 6,
-					0,
-					"INT", 3);
-				intr = 0;
-			}
+			getdim();
+			sendpkt("busbuuuu", MSG_CHANNEL_REQUEST,
+				send.chan,
+				"window-change", 13,
+				0,
+				tty.cols,
+				tty.lines,
+				tty.xpixels,
+				tty.ypixels);
+			sendpkt("busbs", MSG_CHANNEL_REQUEST,
+				send.chan,
+				"signal", 6,
+				0,
+				"INT", 3);
+			intr = 0;
 			continue;
 		}
 		if(n <= 0)