diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2015-04-08 14:29:05 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-04-14 11:35:31 +0200 |
commit | 843a66170a4e51e0a614498e74f3526afc4bff52 (patch) | |
tree | d7ddeb255596ce045ba0b50500256039fd31a0cb /src/util | |
parent | c526cd124515cc2d44a413dcbfd4a74ddb490150 (diff) | |
download | sssd-843a66170a4e51e0a614498e74f3526afc4bff52.tar.gz sssd-843a66170a4e51e0a614498e74f3526afc4bff52.tar.xz sssd-843a66170a4e51e0a614498e74f3526afc4bff52.zip |
UTIL: Add a simple function to get the fd of debug_file
Reviewed-by: Pavel Reichl <preichl@redhat.com>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/debug.c | 9 | ||||
-rw-r--r-- | src/util/util.h | 1 |
2 files changed, 10 insertions, 0 deletions
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" |