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/engine-g13.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/engine-g13.c') diff --git a/src/engine-g13.c b/src/engine-g13.c index 9850d6b4..9231a9ac 100644 --- a/src/engine-g13.c +++ b/src/engine-g13.c @@ -225,7 +225,7 @@ g13_new (void **engine, const char *file_name, const char *home_dir) g13 = calloc (1, sizeof *g13); if (!g13) - return gpg_error_from_errno (errno); + return gpg_error_from_syserror (); g13->status_cb.fd = -1; g13->status_cb.dir = 1; @@ -269,7 +269,7 @@ g13_new (void **engine, const char *file_name, const char *home_dir) if (asprintf (&optstr, "OPTION display=%s", dft_display) < 0) { free (dft_display); - err = gpg_error_from_errno (errno); + err = gpg_error_from_syserror (); goto leave; } free (dft_display); @@ -295,7 +295,7 @@ g13_new (void **engine, const char *file_name, const char *home_dir) { if (asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0) { - err = gpg_error_from_errno (errno); + err = gpg_error_from_syserror (); goto leave; } err = assuan_transact (g13->assuan_ctx, optstr, NULL, NULL, NULL, @@ -312,7 +312,7 @@ g13_new (void **engine, const char *file_name, const char *home_dir) if (asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype) < 0) { free (dft_ttytype); - err = gpg_error_from_errno (errno); + err = gpg_error_from_syserror (); goto leave; } free (dft_ttytype); @@ -390,7 +390,7 @@ g13_set_locale (void *engine, int category, const char *value) return 0; if (asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) - err = gpg_error_from_errno (errno); + err = gpg_error_from_syserror (); else { err = assuan_transact (g13->assuan_ctx, optstr, NULL, NULL, -- cgit v1.2.3