* src/w32-io.c (create_writer): Free CTX in cased of bad FD.
* src/w32-util.c (_gpgme_mkstemp): Free TMPNAME in case of a failed
mkstemp.
--
Found by Hans-Christoph Steiner with cppcheck.
* src/w32-io.c (reader_context_s, create_reader)
(writer_context_s, create_writer): Rename STOPPED to CLOSE_EV.
(reader, writer): Remove setting of STOPPED. Wait for CLOSE_EV and
then release the context.
(destroy_reader, destroy_writer): Do not wait but set the CLOSE_EV.
(kill_reader, kill_writer): Remove.
(_gpgme_io_close): Add code from kill_reader and kill_writer.
--
The old code was prone to deadlocks which were actually exhibited at
Kleopatra startup. The new code is much more straightforward and
easier to understand. The reason for the complex old code was
probably due to our former idea to allow re-use of the I/O threads.
However we have long given up on this.
* debug.h (TRACE_SUC6): New macro.
* w32-io.c (MAX_SLAFD): New macro.
(fd_table): New static variable.
(new_fd, release_fd): New functions.
(fd_to_handle, handle_to_fd, handle_to_socket): Remove macros.
(MAX_READERS, MAX_WRITERS): Increase to 64.
(notify_table): Increase to MAX_SLAFD.
(struct reader_context_s, struct writer_context_s): Add member
file_sock.
(reader, writer): Use file_hd vs file_sock to decide if socket
operations to use. Remove auto-detect mode.
(create_reader, create_writer): Set file_sock. Unblock pending
thread only if this is a pipe fd.
(_gpgme_io_pipe): Allocate fds from table and return slot indices
instead of windows handles. This allows to properly handle RVIDs.
(_gpgme_io_close): Handle dup'ed file descriptors.
(build_commandline) [HAVE_W32_SYSTEM]: Use RVID from fd table now.
(_gpgme_io_spawn): Use fd table now.
(_gpgme_io_fd2str): Use RVID from fd table now.
(_gpgme_io_dup): Implement using fd table.
(_gpgme_io_socket): Allocate fds from table.
(_gpgme_io_connect): Use fd from table.
* w32-io.c [HAVE_W32CE_SYSTEM]: Include assuan.h and winioctl.h.
(GPGCEDEV_IOCTL_UNBLOCK) [HAVE_W32CE_SYSTEM]: Define.
(set_synchronize) [HAVE_W32CE_SYSTEM]: Stub it out.
(is_socket): Allow to return -1 for auto-detect (old behaviour).
(is_socket) [HAVE_W32CE_SYSTEM]: Return -1.
(reader): Handle auto-detect case. Handle ctx->stop_me before
checking for EOF.
(destroy_reader) [HAVE_W32CE_SYSTEM]: Unblock a pending reader.
(writer): Handle auto-detect case. Handle ctx->stop_me with
ERROR_BUSY.
(destroy_writer) [HAVE_W32CE_SYSTEM]: Unblock a pending writer.
(_gpgme_io_pipe) [HAVE_W32CE_SYSTEM]: Implement in terms of a
half-pipe.
(build_commandline) [HAVE_W32CE_SYSTEM]: New function.
(_gpgme_io_spawn) [HAVE_W32CE_SYSTEM]: Implement it differently
for this platform.
(_gpgme_io_fd2str) [HAVE_W32CE_SYSTEM]: Implement it for RVIDs.
(_gpgme_io_dup) [HAVE_W32CE_SYSTEM]: Stub it out.
* configure.ac: Require libgpg-error 1.8.
src/
2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* sign.c, data-user.c, conversion.c, debug.c, verify.c, data.c,
decrypt.c, delete.c, assuan-support.c, import.c, engine-gpgsm.c,
data-mem.c, op-support.c, w32-io.c, w32-util.c, data-compat.c: Use
gpg_error_from_syserror instead gpg_error_from_errno, and use
gpg_err_set_errno to set error number.
* setenv.c: Include <gpg-error.h> and define __set_errno to use
gpg_err_set_errno.
* gpgme-tool.c (ARGP_ERR_UNKNOWN): Define to EDEADLOCK (which is
mapped in Windows CE) instead of E2BIG (which is not).
(gt_import_keys): Initialize err.