aboutsummaryrefslogtreecommitdiffstats
path: root/set_error_existing.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-06-09 18:38:43 +0200
committerMattias Andrée <maandree@kth.se>2020-06-09 18:38:43 +0200
commit22ae5a6a98ec6aa98207bddc37a1200ea74d134b (patch)
treeeedbf11d6fb597573a3b6d1a55571af8c5fa57ca /set_error_existing.c
parentFix filename typo (diff)
downloadliberror-22ae5a6a98ec6aa98207bddc37a1200ea74d134b.tar.gz
liberror-22ae5a6a98ec6aa98207bddc37a1200ea74d134b.tar.bz2
liberror-22ae5a6a98ec6aa98207bddc37a1200ea74d134b.tar.xz
Add liberror_pop_error and liberror_set_error_existing
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'set_error_existing.c')
-rw-r--r--set_error_existing.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/set_error_existing.c b/set_error_existing.c
new file mode 100644
index 0000000..db6d6f1
--- /dev/null
+++ b/set_error_existing.c
@@ -0,0 +1,17 @@
+/* See LICENSE file for copyright and license details. */
+#include "internal.h"
+
+
+void
+liberror_set_error_existing(struct liberror_error *error)
+{
+ liberror_reset_error();
+ if (error) {
+ liberror_have_error_ = 1;
+ memcpy(&liberror_error_, error, sizeof(*error));
+ if (error->dynamically_allocated) {
+ liberror_error_.dynamically_allocated = 0;
+ free(error);
+ }
+ }
+}