[svn] assuan - r270 - trunk/src
svn author marcus
cvs at cvs.gnupg.org
Fri Oct 5 14:24:09 CEST 2007
Author: marcus
Date: 2007-10-05 14:24:01 +0200 (Fri, 05 Oct 2007)
New Revision: 270
Modified:
trunk/src/ChangeLog
trunk/src/assuan-uds.c
Log:
2007-10-05 Marcus Brinkmann <marcus at g10code.de>
* assuan-uds.c (wsa2errno) [HAVE_W32_SYSTEM]: New function.
(uds_reader, uds_writer) [HAVE_W32_SYSTEM]: Set errno.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-10-04 12:24:29 UTC (rev 269)
+++ trunk/src/ChangeLog 2007-10-05 12:24:01 UTC (rev 270)
@@ -1,3 +1,8 @@
+2007-10-05 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-uds.c (wsa2errno) [HAVE_W32_SYSTEM]: New function.
+ (uds_reader, uds_writer) [HAVE_W32_SYSTEM]: Set errno.
+
2007-10-04 Werner Koch <wk at g10code.com>
* mkerrors: Map EAGAIN to GPG_ERR_EAGAIN for read and write
Modified: trunk/src/assuan-uds.c
===================================================================
--- trunk/src/assuan-uds.c 2007-10-04 12:24:29 UTC (rev 269)
+++ trunk/src/assuan-uds.c 2007-10-05 12:24:01 UTC (rev 270)
@@ -63,6 +63,25 @@
#endif /*USE_DESCRIPTOR_PASSING*/
+#ifdef HAVE_W32_SYSTEM
+int
+wsa2errno (int err)
+{
+ switch (err)
+ {
+ case WSAENOTSOCK:
+ return EINVAL;
+ case WSAEWOULDBLOCK:
+ return EAGAIN;
+ case ERROR_BROKEN_PIPE:
+ return EPIPE;
+ default:
+ return EIO;
+ }
+}
+#endif
+
+
/* Read from a unix domain socket using sendmsg.
FIXME: We don't need the buffering. It is a leftover from the time
@@ -152,7 +171,10 @@
return len;
#else /*HAVE_W32_SYSTEM*/
- return recvfrom (HANDLE2SOCKET(ctx->inbound.fd), buf, buflen, 0, NULL, NULL);
+ int res = recvfrom (HANDLE2SOCKET(ctx->inbound.fd), buf, buflen, 0, NULL, NULL);
+ if (res < 0)
+ errno = wsa2errno (WSAGetLastError ());
+ return res;
#endif /*HAVE_W32_SYSTEM*/
}
@@ -179,9 +201,12 @@
return len;
#else /*HAVE_W32_SYSTEM*/
- return sendto (HANDLE2SOCKET(ctx->outbound.fd), buf, buflen, 0,
- (struct sockaddr *)&ctx->serveraddr,
- sizeof (struct sockaddr_in));
+ int res = sendto (HANDLE2SOCKET(ctx->outbound.fd), buf, buflen, 0,
+ (struct sockaddr *)&ctx->serveraddr,
+ sizeof (struct sockaddr_in));
+ if (res < 0)
+ errno = wsa2errno (WSAGetLastError ());
+ return res;
#endif /*HAVE_W32_SYSTEM*/
}
More information about the Gnupg-commits
mailing list