[svn] assuan - r377 - trunk/src
svn author marcus
cvs at cvs.gnupg.org
Fri Jun 11 01:09:33 CEST 2010
Author: marcus
Date: 2010-06-11 01:09:32 +0200 (Fri, 11 Jun 2010)
New Revision: 377
Modified:
trunk/src/ChangeLog
trunk/src/assuan-handler.c
trunk/src/system-w32ce.c
Log:
2010-06-11 Marcus Brinkmann <marcus at g10code.de>
* assuan-handler.c (std_handler_input,
std_handler_output) [HAVE_W32CE_SYSTEM]: Finish the pipe. We must
do this here, because otherwise assuan_close_input_fd() and
assuan_close_output_fd() can't work.
* system-w32ce.c (_assuan_w32ce_finish_pipe): Call SetLastError in
error case.
(__assuan_close): Save WSAGetLastError before trashing it!
Otherwise handle is never closed and GPGME hangs.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2010-06-10 17:27:24 UTC (rev 376)
+++ trunk/src/ChangeLog 2010-06-10 23:09:32 UTC (rev 377)
@@ -1,3 +1,14 @@
+2010-06-11 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-handler.c (std_handler_input,
+ std_handler_output) [HAVE_W32CE_SYSTEM]: Finish the pipe. We must
+ do this here, because otherwise assuan_close_input_fd() and
+ assuan_close_output_fd() can't work.
+ * system-w32ce.c (_assuan_w32ce_finish_pipe): Call SetLastError in
+ error case.
+ (__assuan_close): Save WSAGetLastError before trashing it!
+ Otherwise handle is never closed and GPGME hangs.
+
2010-06-10 Marcus Brinkmann <marcus at g10code.de>
* w32ce-add.h (ASSUAN_STDIN, ASSUAN_STDOUT): Define magic handle values.
Modified: trunk/src/assuan-handler.c
===================================================================
--- trunk/src/assuan-handler.c 2010-06-10 17:27:24 UTC (rev 376)
+++ trunk/src/assuan-handler.c 2010-06-10 23:09:32 UTC (rev 377)
@@ -264,6 +264,17 @@
rc = assuan_command_parse_fd (ctx, line, &fd);
if (rc)
return PROCESS_DONE (ctx, rc);
+
+#ifdef HAVE_W32CE_SYSTEM
+ oldfd = fd;
+ fd = _assuan_w32ce_finish_pipe ((int)fd, 0);
+ if (fd == INVALID_HANDLE_VALUE)
+ return PROCESS_DONE (ctx, set_error (ctx, GPG_ERR_ASS_PARAMETER,
+ "rvid conversion failed"));
+ TRACE2 (ctx, ASSUAN_LOG_SYSIO, "std_handler_input", ctx,
+ "turned RVID 0x%x into handle 0x%x", oldfd, fd);
+#endif
+
if (ctx->input_notify_fnc)
{
oldfd = ctx->input_fd;
@@ -284,10 +295,21 @@
{
gpg_error_t rc;
assuan_fd_t fd, oldfd;
-
+
rc = assuan_command_parse_fd (ctx, line, &fd);
if (rc)
return PROCESS_DONE (ctx, rc);
+
+#ifdef HAVE_W32CE_SYSTEM
+ oldfd = fd;
+ fd = _assuan_w32ce_finish_pipe ((int)fd, 1);
+ if (fd == INVALID_HANDLE_VALUE)
+ return PROCESS_DONE (ctx, set_error (ctx, gpg_err_code_from_syserror (),
+ "rvid conversion failed"));
+ TRACE2 (ctx, ASSUAN_LOG_SYSIO, "std_handler_output", ctx,
+ "turned RVID 0x%x into handle 0x%x", oldfd, fd);
+#endif
+
if (ctx->output_notify_fnc)
{
oldfd = ctx->output_fd;
Modified: trunk/src/system-w32ce.c
===================================================================
--- trunk/src/system-w32ce.c 2010-06-10 17:27:24 UTC (rev 376)
+++ trunk/src/system-w32ce.c 2010-06-10 23:09:32 UTC (rev 377)
@@ -159,7 +159,10 @@
HANDLE hd;
if (!rvid)
- return INVALID_HANDLE_VALUE;
+ {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return INVALID_HANDLE_VALUE;
+ }
hd = CreateFile (L"GPG1:", write_end? GENERIC_WRITE : GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -259,9 +262,13 @@
__assuan_close (assuan_context_t ctx, assuan_fd_t fd)
{
int rc = closesocket (HANDLE2SOCKET(fd));
+ int err = WSAGetLastError ();
+
+ /* Note that gpg_err_set_errno on Windows CE overwrites
+ WSAGetLastError() (via SetLastError()). */
if (rc)
- gpg_err_set_errno ( _assuan_sock_wsa2errno (WSAGetLastError ()) );
- if (rc && WSAGetLastError () == WSAENOTSOCK)
+ gpg_err_set_errno (_assuan_sock_wsa2errno (err));
+ if (rc && err == WSAENOTSOCK)
{
rc = CloseHandle (fd);
if (rc)
More information about the Gnupg-commits
mailing list