From 85fee89a19a7e9657f9d76949bcdbf4b6c42d182 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sun, 1 Jun 2003 21:11:40 +0000 Subject: 2003-06-01 Marcus Brinkmann * src/mkerrcodes1.awk: New file. * src/mkerrcodes2.awk: New file. * src/mkerrnos.awk: New file. * src/errnos.in: New file. * src/code-from-errno.c: New file. * src/code-to-errno.c: New file. * src/Makefile.am (libgpg_error_la_SOURCES): Remove err-sources.h and err-codes.h. Add code-to-errno.c and code-from-errno.c. (code-to-errno.h): New target. (code-from-errno.h): Likewise. (EXTRA_DIST): Add mkerrnos.awk, errnos.in, and mkerrcodes1.awk. (BUILT_SOURCES): Add code-to-errno.h and code-from-errno.h. (CLEANFILES): Likewise. * src/strerror.c (gpg_strerror): Use strerror for system errors. * src/err-codes.h.in: Add 16382 (Unknown system error). * src/gpg-error.h (gpg_err_code_t): Add system errors. (GPG_ERR_CODE_DIM): Change to 32768. (GPG_ERR_SYSTEM_ERROR): New macro. (gpg_err_code_from_errno): New prototype. (gpg_err_code_to_errno): Likewise. --- src/strerror.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/strerror.c') diff --git a/src/strerror.c b/src/strerror.c index f0fb9e9..3e627b1 100644 --- a/src/strerror.c +++ b/src/strerror.c @@ -33,5 +33,14 @@ const char * gpg_strerror (gpg_error_t err) { gpg_err_code_t code = gpg_err_code (err); + + if (code & GPG_ERR_SYSTEM_ERROR) + { + int no = gpg_err_code_to_errno (err); + if (no) + return strerror (no); + else + code = GPG_ERR_UNKNOWN_ERRNO; + } return dgettext (PACKAGE, msgstr + msgidx[msgidxof (code)]); } -- cgit v1.2.3