[svn] assuan - r246 - trunk/src
svn author wk
cvs at cvs.gnupg.org
Thu Jul 12 17:27:03 CEST 2007
Author: wk
Date: 2007-07-12 17:26:33 +0200 (Thu, 12 Jul 2007)
New Revision: 246
Modified:
trunk/src/ChangeLog
trunk/src/assuan-io-pth.c
trunk/src/assuan-io.c
Log:
Better error code mapping.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-07-12 10:06:26 UTC (rev 245)
+++ trunk/src/ChangeLog 2007-07-12 15:26:33 UTC (rev 246)
@@ -14,6 +14,9 @@
* assuan-handler.c (assuan_get_active_fds) [W32]: Use
_get_osfhandle for the data fp.
+ * assuan-io.c (_assuan_simple_write): Return EPIPE on a closed pipe.
+ (_assuan_simple_read): Likewise
+
2007-07-08 Marcus Brinkmann <marcus at g10code.de>
* assuan-defs.h (struct assuan_context_s): Have full peercred
Modified: trunk/src/assuan-io-pth.c
===================================================================
--- trunk/src/assuan-io-pth.c 2007-07-12 10:06:26 UTC (rev 245)
+++ trunk/src/assuan-io-pth.c 2007-07-12 15:26:33 UTC (rev 246)
@@ -54,7 +54,7 @@
ssize_t
_assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size)
{
- /* Fixme: For W32 we ehsould better not cast the HANDLE type to int.
+ /* Fixme: For W32 we should better not cast the HANDLE type to int.
However, this requires changes in w32pth too. */
return pth_read ((int)ctx->inbound.fd, buffer, size);
}
Modified: trunk/src/assuan-io.c
===================================================================
--- trunk/src/assuan-io.c 2007-07-12 10:06:26 UTC (rev 245)
+++ trunk/src/assuan-io.c 2007-07-12 15:26:33 UTC (rev 246)
@@ -63,7 +63,11 @@
n = ReadFile (ctx->inbound.fd, buffer, size, &nread, NULL);
if (!n)
{
- errno = EIO; /* FIXME: We should have a proper mapping. */
+ switch (GetLastError())
+ {
+ case ERROR_BROKEN_PIPE: errno = EPIPE; break;
+ default: errno = EIO;
+ }
n = -1;
}
else
@@ -92,7 +96,12 @@
n = WriteFile (ctx->outbound.fd, buffer, size, &nwrite, NULL);
if (!n)
{
- errno = EIO; /* FIXME: We should have a proper mapping. */
+ switch (GetLastError ())
+ {
+ case ERROR_BROKEN_PIPE:
+ case ERROR_NO_DATA: errno = EPIPE; break;
+ default: errno = EIO; break;
+ }
n = -1;
}
else
More information about the Gnupg-commits
mailing list