[svn] w32pth - r35 - trunk
svn author wk
cvs at cvs.gnupg.org
Wed Apr 14 11:35:43 CEST 2010
Author: wk
Date: 2010-04-14 11:35:43 +0200 (Wed, 14 Apr 2010)
New Revision: 35
Modified:
trunk/ChangeLog
trunk/w32-io.c
trunk/w32-pth.c
Log:
Changes for W32CE
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-03-23 10:20:55 UTC (rev 34)
+++ trunk/ChangeLog 2010-04-14 09:35:43 UTC (rev 35)
@@ -1,3 +1,8 @@
+2010-04-08 Werner Koch <wk at g10code.com>
+
+ * w32-io.c (reader, writer) [W32CE]: Take care of
+ ERROR_PIPE_NOT_CONNECTED.
+
2010-03-23 Werner Koch <wk at g10code.com>
* w32-io.c (create_pipe) [W32CE]: Change to new driver semantics.
Modified: trunk/w32-io.c
===================================================================
--- trunk/w32-io.c 2010-03-23 10:20:55 UTC (rev 34)
+++ trunk/w32-io.c 2010-04-14 09:35:43 UTC (rev 35)
@@ -352,6 +352,19 @@
ctx->eof = 1;
TRACE_LOG ("got EOF (broken pipe)");
}
+#ifdef HAVE_W32CE_SYSTEM
+ else if (ctx->error_code == ERROR_PIPE_NOT_CONNECTED
+ || ctx->error_code == ERROR_BUSY)
+ {
+ /* This may happen while one pipe end is still dangling
+ because the child process has not yet completed the
+ pipe creation. ERROR_BUSY has been seen as well, it
+ is propabaly returned by the device manager. */
+ ctx->error_code = 0;
+ Sleep (100);
+ continue;
+ }
+#endif
else
{
ctx->error = 1;
@@ -673,6 +686,19 @@
ctx->nbytes, &nwritten, NULL))
{
ctx->error_code = (int) GetLastError ();
+#ifdef HAVE_W32CE_SYSTEM
+ if (ctx->error_code == ERROR_PIPE_NOT_CONNECTED
+ || ctx->error_code == ERROR_BUSY)
+ {
+ /* This may happen while one pipe end is still dangling
+ because the child process has not yet completed the
+ pipe creation. ERROR_BUSY has been seen as well, it
+ is propabaly returned by the device manager. */
+ ctx->error_code = 0;
+ Sleep (100);
+ continue;
+ }
+#endif
ctx->error = 1;
TRACE_LOG1 ("write error: ec=%d", ctx->error_code);
break;
Modified: trunk/w32-pth.c
===================================================================
--- trunk/w32-pth.c 2010-03-23 10:20:55 UTC (rev 34)
+++ trunk/w32-pth.c 2010-04-14 09:35:43 UTC (rev 35)
@@ -885,6 +885,27 @@
static int
+pipe_is_not_connected (void)
+{
+#ifdef HAVE_W32CE_SYSTEM
+ switch (GetLastError ())
+ {
+ case ERROR_PIPE_NOT_CONNECTED:
+ /* This may happen while one pipe end is still dangling
+ because the child process has not yet completed the
+ pipe creation. */
+ case ERROR_BUSY:
+ /* Returned by the device manager? */
+ Sleep (100);
+ return 1;
+
+ }
+#endif
+ return 0;
+}
+
+
+static int
do_pth_read (int fd, void * buffer, size_t size)
{
int n;
@@ -901,13 +922,16 @@
if (n == -1 && WSAGetLastError () == WSAENOTSOCK)
{
DWORD nread = 0;
- n = ReadFile ((HANDLE)fd, buffer, size, &nread, NULL);
+
+ do
+ n = ReadFile ((HANDLE)fd, buffer, size, &nread, NULL);
+ while (!n && pipe_is_not_connected ());
if (!n)
{
char strerr[256];
if (DBG_ERROR)
- fprintf (dbgfp, "%s: pth_read(%d) failed read from file: %s\n",
+ fprintf (dbgfp, "%s: pth_read(0x%x) ReadFile failed: %s\n",
log_get_prefix (NULL), fd,
w32_strerror (strerr, sizeof strerr));
n = -1;
@@ -1014,7 +1038,7 @@
n = -1;
set_errno (map_w32_to_errno (GetLastError ()));
if (DBG_ERROR)
- fprintf (dbgfp, "%s: pth_write(%d) failed in write: %s\n",
+ fprintf (dbgfp, "%s: pth_write(0x%x) failed in write: %s\n",
log_get_prefix (NULL), fd,
w32_strerror (strerr, sizeof strerr));
}
@@ -1623,6 +1647,7 @@
int
pth_join (pth_t hd, void **value)
{
+#warning fixme: We need to implement this.
return TRUE;
}
More information about the Gnupg-commits
mailing list