render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
7a3408
From 9de6f8ef5dbda65683717dd0001cb606792a9ca3 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <9de6f8ef5dbda65683717dd0001cb606792a9ca3@dist-git>
7a3408
From: Jiri Denemark <jdenemar@redhat.com>
7a3408
Date: Fri, 10 Jul 2015 08:44:41 +0200
7a3408
Subject: [PATCH] Introduce virErrorCopyNew
7a3408
7a3408
A helper function for copying error objects.
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
(cherry picked from commit 9d0a2af6c230ce3007b3504907ccdba09cdc4cf2)
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1090093
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 docs/apibuild.py         |  1 +
7a3408
 src/libvirt_private.syms |  1 +
7a3408
 src/util/virerror.c      | 16 ++++++++++++++++
7a3408
 src/util/virerror.h      |  1 +
7a3408
 4 files changed, 19 insertions(+)
7a3408
7a3408
diff --git a/docs/apibuild.py b/docs/apibuild.py
7a3408
index 69f991d..f934fb2 100755
7a3408
--- a/docs/apibuild.py
7a3408
+++ b/docs/apibuild.py
7a3408
@@ -102,6 +102,7 @@ ignored_functions = {
7a3408
   "virDomainMigratePrepare3Params": "private function for migration",
7a3408
   "virDomainMigrateConfirm3Params": "private function for migration",
7a3408
   "virDomainMigratePrepareTunnel3Params": "private function for tunnelled migration",
7a3408
+  "virErrorCopyNew": "private",
7a3408
 }
7a3408
 
7a3408
 ignored_macros = {
7a3408
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
7a3408
index 65168b1..1a03268 100644
7a3408
--- a/src/libvirt_private.syms
7a3408
+++ b/src/libvirt_private.syms
7a3408
@@ -1365,6 +1365,7 @@ ebtablesRemoveForwardAllowIn;
7a3408
 
7a3408
 # util/virerror.h
7a3408
 virDispatchError;
7a3408
+virErrorCopyNew;
7a3408
 virErrorInitialize;
7a3408
 virErrorSetErrnoFromLastError;
7a3408
 virLastErrorIsSystemErrno;
7a3408
diff --git a/src/util/virerror.c b/src/util/virerror.c
7a3408
index fae627b..60b2e79 100644
7a3408
--- a/src/util/virerror.c
7a3408
+++ b/src/util/virerror.c
7a3408
@@ -214,6 +214,22 @@ virCopyError(virErrorPtr from,
7a3408
     return ret;
7a3408
 }
7a3408
 
7a3408
+
7a3408
+virErrorPtr
7a3408
+virErrorCopyNew(virErrorPtr err)
7a3408
+{
7a3408
+    virErrorPtr ret;
7a3408
+
7a3408
+    if (VIR_ALLOC_QUIET(ret) < 0)
7a3408
+        return NULL;
7a3408
+
7a3408
+    if (virCopyError(err, ret) < 0)
7a3408
+        VIR_FREE(ret);
7a3408
+
7a3408
+    return ret;
7a3408
+}
7a3408
+
7a3408
+
7a3408
 static virErrorPtr
7a3408
 virLastErrorObject(void)
7a3408
 {
7a3408
diff --git a/src/util/virerror.h b/src/util/virerror.h
7a3408
index baa2d08..2348648 100644
7a3408
--- a/src/util/virerror.h
7a3408
+++ b/src/util/virerror.h
7a3408
@@ -185,6 +185,7 @@ void virReportOOMErrorFull(int domcode,
7a3408
     virRaiseErrorObject(__FILE__, __FUNCTION__, __LINE__, obj)
7a3408
 
7a3408
 int virSetError(virErrorPtr newerr);
7a3408
+virErrorPtr virErrorCopyNew(virErrorPtr err);
7a3408
 void virDispatchError(virConnectPtr conn);
7a3408
 const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen);
7a3408
 
7a3408
-- 
7a3408
2.4.5
7a3408