aboutsummaryrefslogtreecommitdiffstats
path: root/common/miscellaneous.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-04-25 15:26:57 +0000
committerWerner Koch <[email protected]>2016-04-25 15:26:57 +0000
commit8776abbe02935e720018f3ef6ffd48f21435ff8b (patch)
tree6a848deb9fd8199520300824752816cec32365d8 /common/miscellaneous.c
parentcommon: Drop unused variables, fix warnings. (diff)
downloadgnupg-8776abbe02935e720018f3ef6ffd48f21435ff8b.tar.gz
gnupg-8776abbe02935e720018f3ef6ffd48f21435ff8b.zip
common: Use new function to print a failure of xtrymalloc.
* common/miscellaneous.c (xoutofcore): New. * common/strlist.c (append_to_strlist): Use instead of abort. (append_to_strlist_try): Use xtrymalloc instead of xmalloc. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/miscellaneous.c')
-rw-r--r--common/miscellaneous.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/miscellaneous.c b/common/miscellaneous.c
index ec36f08ea..8d9a7aa73 100644
--- a/common/miscellaneous.c
+++ b/common/miscellaneous.c
@@ -106,6 +106,17 @@ setup_libgcrypt_logging (void)
}
+/* Print an out of core message and let the process die. The printed
+ * error is taken from ERRNO. */
+void
+xoutofcore (void)
+{
+ gpg_error_t err = gpg_error_from_syserror ();
+ log_fatal (_("error allocating enough memory: %s\n"), gpg_strerror (err));
+ abort (); /* Never called; just to make the compiler happy. */
+}
+
+
/* A wrapper around gcry_cipher_algo_name to return the string
"AES-128" instead of "AES". Given that we have an alias in
libgcrypt for it, it does not harm to too much to return this other