From 51fd6d8292cb41d743407e6ac9d86a5ab8e68d8c Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 6 Feb 2013 17:35:40 +0100 Subject: Use gpg_error_from_syserror instead of directly accessing errno. -- Also fixed a couple of minor thing; e.g. save the error before calling cleanup functions. Do not save the errno if only free is called in between. --- src/wait.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/wait.c') diff --git a/src/wait.c b/src/wait.c index 992f2350..20b23032 100644 --- a/src/wait.c +++ b/src/wait.c @@ -73,7 +73,7 @@ fd_table_put (fd_table_t fdt, int fd, int dir, void *opaque, int *idx) new_fds = realloc (fdt->fds, (fdt->size + FDT_ALLOCSIZE) * sizeof (*new_fds)); if (!new_fds) - return gpg_error_from_errno (errno); + return gpg_error_from_syserror (); fdt->fds = new_fds; fdt->size += FDT_ALLOCSIZE; @@ -113,16 +113,15 @@ _gpgme_add_io_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc, tag = malloc (sizeof *tag); if (!tag) - return gpg_error_from_errno (errno); + return gpg_error_from_syserror (); tag->ctx = ctx; /* Allocate a structure to hold information about the handler. */ item = calloc (1, sizeof *item); if (!item) { - int saved_errno = errno; free (tag); - return gpg_error_from_errno (saved_errno); + return gpg_error_from_syserror (); } item->ctx = ctx; item->dir = dir; -- cgit v1.2.3