[PATCH 37/47] libsemanage: preserve errno during internal logging

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

 



From: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>

Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
---
 libsemanage/src/debug.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libsemanage/src/debug.h b/libsemanage/src/debug.h
index a18a95be..506b9db0 100644
--- a/libsemanage/src/debug.h
+++ b/libsemanage/src/debug.h
@@ -23,6 +23,7 @@
 #ifndef _SEMANAGE_INTERNAL_DEBUG_H_
 #define _SEMANAGE_INTERNAL_DEBUG_H_
 
+#include <errno.h>
 #include <stdio.h>
 #include <semanage/debug.h>
 #include <sepol/debug.h>
@@ -36,6 +37,8 @@
 	          channel_arg, func_arg, ...) do {         \
 	                                                   \
         if ((handle_arg)->msg_callback) {                  \
+                int errsv__ = errno;                       \
+                                                           \
                 (handle_arg)->msg_fname = func_arg;        \
                 (handle_arg)->msg_channel = channel_arg;   \
                 (handle_arg)->msg_level = level_arg;       \
@@ -43,6 +46,8 @@
                 (handle_arg)->msg_callback(                \
                         (handle_arg)->msg_callback_arg,    \
                         handle_arg, __VA_ARGS__);          \
+                                                           \
+                errno = errsv__;                           \
         }                                                  \
 } while(0)
 
-- 
2.45.2





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux