From 52d8ed8dfb91a2b302c20bee27e9a28b7cb6a518 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 7 Jun 2019 11:17:53 +0200 Subject: core: Replace the posix close notify mechanism by a new generic one. * src/fdtable.c, src/fdtable.h: New. * src/posix-io.c (notify_table_item_s): Remove. (notify_table, notify_table_size, notify_table_lock): Remove. (_gpgme_io_pipe): Put new fds into the table. (_gpgme_io_dup): Ditto. (_gpgme_io_close): Replace notify stuff by a call to the fdtable. (_gpgme_io_set_close_notify): Remove. Change all callers to to use _gpgme_fdtable_add_close_notify. * src/Makefile.am (main_sources): Add new files. -- This is the first part or a larger change to unify the tracking of file descriptors. Right now this has only been implemented for Posix and thus the code will not yet build for Windows. Signed-off-by: Werner Koch --- src/engine-spawn.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/engine-spawn.c') diff --git a/src/engine-spawn.c b/src/engine-spawn.c index 296d7f25..39428f29 100644 --- a/src/engine-spawn.c +++ b/src/engine-spawn.c @@ -84,7 +84,7 @@ static gpgme_error_t engspawn_cancel (void *engine); -static void +static gpg_error_t close_notify_handler (int fd, void *opaque) { engine_spawn_t esp = opaque; @@ -110,6 +110,7 @@ close_notify_handler (int fd, void *opaque) } } } + return 0; } @@ -180,8 +181,10 @@ build_fd_data_map (engine_spawn_t esp) esp->fd_data_map = NULL; return gpg_error_from_syserror (); } - if (_gpgme_io_set_close_notify (fds[0], close_notify_handler, esp) - || _gpgme_io_set_close_notify (fds[1], close_notify_handler, esp)) + if (_gpgme_fdtable_add_close_notify (fds[0], + close_notify_handler, esp) + || _gpgme_fdtable_add_close_notify (fds[1], + close_notify_handler, esp)) { /* FIXME: Need error cleanup. */ return gpg_error (GPG_ERR_GENERAL); -- cgit