[Ttssh2-commit] [5191] ~/. bashrc に、

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2013年 4月 5日 (金) 22:35:10 JST


Revision: 5191
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5191
Author:   yutakapon
Date:     2013-04-05 22:35:09 +0900 (Fri, 05 Apr 2013)
Log Message:
-----------
~/.bashrc に、
  stty stop undef
という定義があると、SCP送信でTera Term(TTSSH)が不正終了する現象への
暫定処置を行った。
cf.
http://d.hatena.ne.jp/iww/20130208/scp

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/ssh.c

-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2013-04-04 15:10:37 UTC (rev 5190)
+++ trunk/ttssh2/ttxssh/ssh.c	2013-04-05 13:35:09 UTC (rev 5191)
@@ -8031,7 +8031,7 @@
 	return TRUE;
 }
 
-
+// cf. response()#scp.c
 static void SSH2_scp_response(PTInstVar pvar, Channel_t *c, unsigned char *data, unsigned int buflen)
 {
 	if (c->scp.dir == FROMREMOTE) {
@@ -8051,18 +8051,36 @@
 	{  // error
 		char msg[2048];
 		unsigned int i, max;
+		int offset, resp;
 
+		resp = data[0];
+
+		// \x83G\x83\x89\x81[\x83R\x81[\x83h\x82ɂ\xE6\x82蕶\x8E\x9A\x97\xF1\x82̊i\x94[\x8Fꏊ\x82\xAA\x8E኱\x88قȂ\xE9\x81B
+		if (resp == 1 || /* error, followed by error msg */
+			resp == 2) {  /* fatal error, "" */
+			offset = 1;
+		} else {
+			offset = 0;
+		}
+
 		if (buflen > sizeof(msg))
 			max = sizeof(msg);
 		else
 			max = buflen - 1;
 		for (i = 0 ; i < max ; i++) {
-			msg[i] = data[i + 1];
+			msg[i] = data[i + offset];
 		}
 		msg[i] = '\0';
 
-		ssh2_channel_send_close(pvar, c);
-		//ssh2_channel_delete(c);  // free channel
+		// \x82悭\x95\xAA\x82\xA9\x82\xE7\x82Ȃ\xA2\x83G\x83\x89\x81[\x82̏ꍇ\x82́A\x8E\xA9\x90g\x82Ń`\x83\x83\x83l\x83\x8B\x82\xF0\x83N\x83\x8D\x81[\x83Y\x82\xB7\x82\xE9\x81B
+		// .bashrc \x82\xC9"stty stop undef"\x82\xAA\x92\xE8\x8B`\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9\x82ƁATTSSH\x82\xAA\x97\x8E\x82\xBF\x82\xE9\x96\xE2\x91\xE8\x82ւ̎b\x92菈\x92u\x81B
+		// \x97\x8E\x82\xBF\x82錴\x88\xF6\x82͕\xAA\x82\xA9\x82\xC1\x82Ă\xA2\x82Ȃ\xA2\x81B
+		// (2013.4.5 yutaka)
+		if (resp == 1) {
+			ssh2_channel_send_close(pvar, c);
+		} else {
+			ssh2_channel_delete(c);  // free channel
+		}
 
 		MessageBox(NULL, msg, "TTSSH: SCP error", MB_OK | MB_ICONEXCLAMATION);
 	}



Ttssh2-commit メーリングリストの案内
Back to archive index