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);
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);
if (count == 0)
return TRACE_SYSRES (0);
- ctx = find_writer (fd, 0);
+ ctx = find_writer (fd, 1);
if (!ctx)
return TRACE_SYSRES (-1);
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)",
{
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)",
}
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)",
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
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