From 843a66170a4e51e0a614498e74f3526afc4bff52 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 8 Apr 2015 14:29:05 +0200 Subject: UTIL: Add a simple function to get the fd of debug_file Reviewed-by: Pavel Reichl --- src/util/debug.c | 9 +++++++++ src/util/util.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/util/debug.c b/src/util/debug.c index 3121c70b1..bf83624c9 100644 --- a/src/util/debug.c +++ b/src/util/debug.c @@ -70,6 +70,15 @@ errno_t set_debug_file_from_fd(const int fd) return EOK; } +int get_fd_from_debug_file(void) +{ + if (debug_file == NULL) { + return STDERR_FILENO; + } + + return fileno(debug_file); +} + int debug_convert_old_level(int old_level) { if ((old_level != 0) && !(old_level & 0x000F)) diff --git a/src/util/util.h b/src/util/util.h index 704e10dc6..d831d533f 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -78,6 +78,7 @@ void debug_fn(const char *file, const char *format, ...) SSS_ATTRIBUTE_PRINTF(5,6); int debug_convert_old_level(int old_level); errno_t set_debug_file_from_fd(const int fd); +int get_fd_from_debug_file(void); #define SSS_DOM_ENV "_SSS_DOM" -- cgit