summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/child_common.c10
-rw-r--r--src/util/debug.c3
-rw-r--r--src/util/util.h3
3 files changed, 15 insertions, 1 deletions
diff --git a/src/util/child_common.c b/src/util/child_common.c
index 08aac1143..81bbab70e 100644
--- a/src/util/child_common.c
+++ b/src/util/child_common.c
@@ -637,8 +637,10 @@ static errno_t prepare_child_argv(TALLOC_CTX *mem_ctx,
bool child_debug_to_file = debug_to_file;
bool child_debug_timestamps = debug_timestamps;
bool child_debug_microseconds = debug_microseconds;
+ bool child_debug_stderr = debug_to_stderr;
if (child_debug_to_file) argc++;
+ if (child_debug_stderr) argc++;
/*
* program name, debug_level, debug_to_file, debug_timestamps,
@@ -659,6 +661,14 @@ static errno_t prepare_child_argv(TALLOC_CTX *mem_ctx,
goto fail;
}
+ if (child_debug_stderr) {
+ argv[--argc] = talloc_strdup(argv, "--debug-to-stderr");
+ if (argv[argc] == NULL) {
+ ret = ENOMEM;
+ goto fail;
+ }
+ }
+
if (child_debug_to_file) {
argv[--argc] = talloc_asprintf(argv, "--debug-fd=%d",
child_debug_fd);
diff --git a/src/util/debug.c b/src/util/debug.c
index b66de07b4..a99d5403a 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -42,6 +42,7 @@ int debug_level = SSSDBG_UNRESOLVED;
int debug_timestamps = SSSDBG_TIMESTAMP_UNRESOLVED;
int debug_microseconds = SSSDBG_MICROSECONDS_UNRESOLVED;
int debug_to_file = 0;
+int debug_to_stderr = 0;
const char *debug_log_file = "sssd";
FILE *debug_file = NULL;
@@ -212,7 +213,7 @@ void debug_fn(const char *file,
errno_t ret;
va_list ap_fallback;
- if (!debug_file) {
+ if (!debug_file && !debug_to_stderr) {
/* If we are not outputting logs to files, we should be sending them
* to journald.
* NOTE: on modern systems, this is where stdout/stderr will end up
diff --git a/src/util/util.h b/src/util/util.h
index 5c02c33a5..6a9bc0c2e 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -68,6 +68,7 @@ extern int debug_level;
extern int debug_timestamps;
extern int debug_microseconds;
extern int debug_to_file;
+extern int debug_to_stderr;
extern const char *debug_log_file;
void debug_fn(const char *file,
long line,
@@ -107,6 +108,8 @@ errno_t set_debug_file_from_fd(const int fd);
_("Debug level"), NULL}, \
{"debug-to-files", 'f', POPT_ARG_NONE, &debug_to_file, 0, \
_("Send the debug output to files instead of stderr"), NULL }, \
+ {"debug-to-stderr", 0, POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN, &debug_to_stderr, 0, \
+ _("Send the debug output to stderr directly."), NULL }, \
{"debug-timestamps", 0, POPT_ARG_INT, &debug_timestamps, 0, \
_("Add debug timestamps"), NULL}, \
{"debug-microseconds", 0, POPT_ARG_INT, &debug_microseconds, 0, \