aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog3
-rw-r--r--src/assuan-io-pth.c2
-rw-r--r--src/assuan-io.c13
3 files changed, 15 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a9616e6..ad04bb9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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 <[email protected]>
* assuan-defs.h (struct assuan_context_s): Have full peercred
diff --git a/src/assuan-io-pth.c b/src/assuan-io-pth.c
index ff6f10d..69774ff 100644
--- a/src/assuan-io-pth.c
+++ b/src/assuan-io-pth.c
@@ -54,7 +54,7 @@ _assuan_waitpid (pid_t pid, int *status, int options)
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);
}
diff --git a/src/assuan-io.c b/src/assuan-io.c
index 7ce43cb..a5e3816 100644
--- a/src/assuan-io.c
+++ b/src/assuan-io.c
@@ -63,7 +63,11 @@ _assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size)
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 @@ _assuan_simple_write (assuan_context_t ctx, const void *buffer, size_t size)
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