svnno****@sourc*****
svnno****@sourc*****
2009年 5月 4日 (月) 23:25:28 JST
Revision: 3376 http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3376 Author: r850 Date: 2009-05-04 23:25:28 +0900 (Mon, 04 May 2009) Log Message: ----------- 「#16384: SCP での上書き確認」のうち、受信部分は対応。 Ticket Links: :----------- http://sourceforge.jp/projects/ttssh2/tracker/detail/16384 Modified Paths: -------------- trunk/ttssh2/ttxssh/ssh.c -------------- next part -------------- Modified: trunk/ttssh2/ttxssh/ssh.c =================================================================== --- trunk/ttssh2/ttxssh/ssh.c 2009-05-04 10:35:13 UTC (rev 3375) +++ trunk/ttssh2/ttxssh/ssh.c 2009-05-04 14:25:28 UTC (rev 3376) @@ -3754,15 +3754,23 @@ } if (_access(c->scp.localfilefull, 0x00) == 0) { - char buf[80]; - _snprintf_s(buf, sizeof(buf), _TRUNCATE, "`%s' file exists. (%d)", c->scp.localfilefull, GetLastError()); - MessageBox(NULL, buf, "TTSSH: file error", MB_OK | MB_ICONERROR); - goto error; + char buf[512]; + int dlgresult; + if (_access(c->scp.localfilefull, 0x02) == -1) { // 0x02 == writable + _snprintf_s(buf, sizeof(buf), _TRUNCATE, "`%s' file is read only.", c->scp.localfilefull); + MessageBox(NULL, buf, "TTSSH: file open error", MB_OK | MB_ICONERROR); + goto error; + } + _snprintf_s(buf, sizeof(buf), _TRUNCATE, "`%s' file exists. (%d)\noverwrite it?", c->scp.localfilefull, GetLastError()); + dlgresult = MessageBox(NULL, buf, "TTSSH: confirm", MB_YESNO | MB_ICONERROR); + if (dlgresult == IDNO) { + goto error; + } } fp = fopen(c->scp.localfilefull, "wb"); if (fp == NULL) { - char buf[80]; + char buf[512]; _snprintf_s(buf, sizeof(buf), _TRUNCATE, "fopen: %d", GetLastError()); MessageBox(NULL, buf, "TTSSH: file open write error", MB_OK | MB_ICONERROR); goto error;