summaryrefslogtreecommitdiff
path: root/src/wait-global.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wait-global.c')
-rw-r--r--src/wait-global.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/wait-global.c b/src/wait-global.c
index 77fd47f..f03775e 100644
--- a/src/wait-global.c
+++ b/src/wait-global.c
@@ -1,19 +1,19 @@
-/* wait-global.c
+/* wait-global.c
Copyright (C) 2000 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
-
+
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -34,6 +34,7 @@
#include "wait.h"
#include "priv-io.h"
#include "ops.h"
+#include "debug.h"
/* The global event loop is used for all asynchronous operations
(except key listing) for which no user I/O callbacks are specified.
@@ -96,7 +97,7 @@ ctx_active (gpgme_ctx_t ctx)
{
struct ctx_list_item *li = malloc (sizeof (struct ctx_list_item));
if (!li)
- return gpg_error_from_errno (errno);
+ return gpg_error_from_syserror ();
li->ctx = ctx;
LOCK (ctx_list_lock);
@@ -268,10 +269,10 @@ gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status,
fdt.fds = malloc (i * sizeof (struct io_select_fd_s));
if (!fdt.fds)
{
- int saved_errno = errno;
+ int saved_err = gpg_error_from_syserror ();
UNLOCK (ctx_list_lock);
if (status)
- *status = gpg_error_from_errno (saved_errno);
+ *status = saved_err;
if (op_err)
*op_err = 0;
return NULL;
@@ -289,10 +290,10 @@ gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status,
nr = _gpgme_io_select (fdt.fds, fdt.size, 0);
if (nr < 0)
{
- int saved_errno = errno;
+ int saved_err = gpg_error_from_syserror ();
free (fdt.fds);
if (status)
- *status = gpg_error_from_errno (saved_errno);
+ *status = saved_err;
if (op_err)
*op_err = 0;
return NULL;
@@ -306,10 +307,10 @@ gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status,
gpgme_error_t err = 0;
gpgme_error_t local_op_err = 0;
struct wait_item_s *item;
-
+
assert (nr);
nr--;
-
+
item = (struct wait_item_s *) fdt.fds[i].opaque;
assert (item);
ictx = item->ctx;
@@ -352,7 +353,7 @@ gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status,
struct gpgme_io_event_done_data data;
data.err = 0;
data.op_err = 0;
-
+
/* FIXME: This does not perform too well. We have to
release the lock because the I/O event handler
acquires it to remove the context from the active