Skip to content

Commit

Permalink
libsemanage: preserve errno during internal logging
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
  • Loading branch information
cgzones authored and jwcart2 committed Nov 21, 2024
1 parent 9e0fead commit b56d915
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libsemanage/src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -36,13 +37,17 @@
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; \
\
(handle_arg)->msg_callback( \
(handle_arg)->msg_callback_arg, \
handle_arg, __VA_ARGS__); \
\
errno = errsv__; \
} \
} while(0)

Expand Down

0 comments on commit b56d915

Please sign in to comment.