[svn] gpgme - r1489 - trunk/src
svn author marcus
cvs at cvs.gnupg.org
Wed Sep 1 02:46:20 CEST 2010
Author: marcus
Date: 2010-09-01 02:46:19 +0200 (Wed, 01 Sep 2010)
New Revision: 1489
Modified:
trunk/src/ChangeLog
trunk/src/w32-io.c
Log:
2010-09-01 Marcus Brinkmann <marcus at g10code.de>
* w32-io.c: Revert change from 2009-06-18, as it created a race
condition.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2010-08-19 13:41:05 UTC (rev 1488)
+++ trunk/src/ChangeLog 2010-09-01 00:46:19 UTC (rev 1489)
@@ -1,3 +1,8 @@
+2010-09-01 Marcus Brinkmann <marcus at g10code.de>
+
+ * w32-io.c: Revert change from 2009-06-18, as it created a race
+ condition.
+
2010-08-18 Marcus Brinkmann <marcus at g10code.de>
* gpgme.def: Add gpgme_err_code_from_syserror and gpgme_err_set_errno.
Modified: trunk/src/w32-io.c
===================================================================
--- trunk/src/w32-io.c 2010-08-19 13:41:05 UTC (rev 1488)
+++ trunk/src/w32-io.c 2010-09-01 00:46:19 UTC (rev 1489)
@@ -561,12 +561,9 @@
if (i != reader_table_size)
{
rd = create_reader (fd);
- if (rd)
- {
- reader_table[i].fd = fd;
- reader_table[i].context = rd;
- reader_table[i].used = 1;
- }
+ reader_table[i].fd = fd;
+ reader_table[i].context = rd;
+ reader_table[i].used = 1;
}
UNLOCK (reader_table_lock);
@@ -921,12 +918,9 @@
if (i != writer_table_size)
{
wt = create_writer (fd);
- if (wt)
- {
- writer_table[i].fd = fd;
- writer_table[i].context = wt;
- writer_table[i].used = 1;
- }
+ writer_table[i].fd = fd;
+ writer_table[i].context = wt;
+ writer_table[i].used = 1;
}
UNLOCK (writer_table_lock);
@@ -965,7 +959,7 @@
if (count == 0)
return TRACE_SYSRES (0);
- ctx = find_writer (fd, 0);
+ ctx = find_writer (fd, 1);
if (!ctx)
return TRACE_SYSRES (-1);
@@ -1146,47 +1140,6 @@
fd_table[wfd].handle = wh;
#endif
- if (inherit_idx == 0)
- {
- struct writer_context_s *ctx;
- ctx = find_writer (wfd, 0);
- assert (ctx == NULL);
- ctx = find_writer (wfd, 1);
- if (!ctx)
- {
- /* No way/need to close RVIDs on Windows CE. */
- if (fd_table[rfd].handle)
- CloseHandle (fd_table[rfd].handle);
- if (fd_table[wfd].handle)
- CloseHandle (fd_table[wfd].handle);
- release_fd (rfd);
- release_fd (wfd);
- /* FIXME: Should translate the error code. */
- gpg_err_set_errno (EIO);
- return TRACE_SYSRES (-1);
- }
- }
- else if (inherit_idx == 1)
- {
- struct reader_context_s *ctx;
- ctx = find_reader (rfd, 0);
- assert (ctx == NULL);
- ctx = find_reader (rfd, 1);
- if (!ctx)
- {
- if (fd_table[rfd].handle)
- CloseHandle (fd_table[rfd].handle);
- /* No way/need to close RVIDs on Windows CE. */
- if (fd_table[wfd].handle)
- CloseHandle (fd_table[wfd].handle);
- release_fd (rfd);
- release_fd (wfd);
- /* FIXME: Should translate the error code. */
- gpg_err_set_errno (EIO);
- return TRACE_SYSRES (-1);
- }
- }
-
filedes[0] = rfd;
filedes[1] = wfd;
return TRACE_SUC6 ("read=0x%x (%p/0x%x), write=0x%x (%p/0x%x)",
@@ -1811,7 +1764,7 @@
{
if (fds[i].for_read)
{
- struct reader_context_s *ctx = find_reader (fds[i].fd,0);
+ struct reader_context_s *ctx = find_reader (fds[i].fd,1);
if (!ctx)
TRACE_LOG1 ("error: no reader for FD 0x%x (ignored)",
@@ -1834,7 +1787,7 @@
}
else if (fds[i].for_write)
{
- struct writer_context_s *ctx = find_writer (fds[i].fd,0);
+ struct writer_context_s *ctx = find_writer (fds[i].fd,1);
if (!ctx)
TRACE_LOG1 ("error: no writer for FD 0x%x (ignored)",
@@ -1995,7 +1948,7 @@
fd_table[newfd].rvid = fd_table[fd].rvid;
fd_table[newfd].dup_from = fd;
- rd_ctx = find_reader (fd, 0);
+ rd_ctx = find_reader (fd, 1);
if (rd_ctx)
{
/* No need for locking, as the only races are against the reader
@@ -2014,7 +1967,7 @@
UNLOCK (reader_table_lock);
}
- wt_ctx = find_writer (fd, 0);
+ wt_ctx = find_writer (fd, 1);
if (wt_ctx)
{
/* No need for locking, as the only races are against the writer
More information about the Gnupg-commits
mailing list