[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] tools/libxc: preserve errno in ERROR and DRINTF macros



commit d1eac8d14ecf6c76a355b461dac208d53a6b15e3
Author:     Olaf Hering <olaf@xxxxxxxxx>
AuthorDate: Tue Mar 11 10:30:49 2014 +0100
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Tue Mar 11 11:37:06 2014 +0000

    tools/libxc: preserve errno in ERROR and DRINTF macros
    
    This simplifies a changes made in a follow-up patch.
    
    Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxc/xc_private.h |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index a610f0c..bd2eb86 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -119,13 +119,28 @@ void xc_report_progress_step(xc_interface *xch,
 
 /* anamorphic macros:  struct xc_interface *xch  must be in scope */
 
-#define IPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_INFO,0, _f , 
## _a)
-#define DPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_DETAIL,0, _f 
, ## _a)
-#define DBGPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_DEBUG,0, 
_f , ## _a)
-
-#define ERROR(_m, _a...)  xc_report_error(xch,XC_INTERNAL_ERROR,_m , ## _a )
-#define PERROR(_m, _a...) xc_report_error(xch,XC_INTERNAL_ERROR,_m \
-                  " (%d = %s)", ## _a , errno, xc_strerror(xch, errno))
+#define IPRINTF(_f, _a...)  do { int IPRINTF_errno = errno; \
+        xc_report(xch, xch->error_handler, XTL_INFO,0, _f , ## _a); \
+        errno = IPRINTF_errno; \
+        } while (0)
+#define DPRINTF(_f, _a...) do { int DPRINTF_errno = errno; \
+        xc_report(xch, xch->error_handler, XTL_DETAIL,0, _f , ## _a); \
+        errno = DPRINTF_errno; \
+        } while (0)
+#define DBGPRINTF(_f, _a...)  do { int DBGPRINTF_errno = errno; \
+        xc_report(xch, xch->error_handler, XTL_DEBUG,0, _f , ## _a); \
+        errno = DBGPRINTF_errno; \
+        } while (0)
+
+#define ERROR(_m, _a...)  do { int ERROR_errno = errno; \
+        xc_report_error(xch,XC_INTERNAL_ERROR,_m , ## _a ); \
+        errno = ERROR_errno; \
+        } while (0)
+#define PERROR(_m, _a...) do { int PERROR_errno = errno; \
+        xc_report_error(xch,XC_INTERNAL_ERROR,_m " (%d = %s)", \
+        ## _a , errno, xc_strerror(xch, errno)); \
+        errno = PERROR_errno; \
+        } while (0)
 
 /*
  * HYPERCALL ARGUMENT BUFFERS
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.