return (state.logtype == DEBUG_DEFAULT_STDERR) || (state.logtype == DEBUG_STDERR);
}
+bool debug_get_output_is_stdout(void)
+{
+ return (state.logtype == DEBUG_DEFAULT_STDOUT) || (state.logtype == DEBUG_STDOUT);
+}
+
/**************************************************************************
reopen the log files
note that we now do this unconditionally
switch (state.logtype) {
case DEBUG_STDOUT:
+ case DEBUG_DEFAULT_STDOUT:
debug_close_fd(state.fd);
state.fd = 1;
return true;
bool dbghdrclass(int level, int cls, const char *location, const char *func);
bool dbghdr(int level, const char *location, const char *func);
bool debug_get_output_is_stderr(void);
+bool debug_get_output_is_stdout(void);
void debug_schedule_reopen_logs(void);
char *debug_list_class_names_and_levels(void);
talloc_enable_null_tracking();
frame = talloc_stackframe();
+ setup_logging(argv[0], DEBUG_DEFAULT_STDOUT);
+
load_case_tables();
global_nmb_port = NMB_PORT;
DEBUG(0,("ERROR: Can't log to stdout (-S) unless daemon is in foreground (-F) or interactive (-i)\n"));
exit(1);
}
+
if (log_stdout) {
- setup_logging( argv[0], DEBUG_STDOUT);
+ setup_logging(argv[0], DEBUG_STDOUT);
} else {
setup_logging( argv[0], DEBUG_FILE);
}
/* close our standard file
descriptors */
- close_low_fds(False);
+ if (!debug_get_output_is_stdout()) {
+ close_low_fds(False); /* Don't close stderr */
+ }
/*
* Can't use TALLOC_FREE here. Nulling out the argument to it
talloc_enable_null_tracking();
frame = talloc_stackframe();
+ setup_logging(argv[0], DEBUG_DEFAULT_STDOUT);
+
load_case_tables();
smbd_init_globals();
smbd_server_conn->sock = dup(0);
/* close our standard file descriptors */
- close_low_fds(False); /* Don't close stderr */
+ if (!debug_get_output_is_stdout()) {
+ close_low_fds(False); /* Don't close stderr */
+ }
#ifdef HAVE_ATEXIT
atexit(killkids);
talloc_enable_null_tracking();
frame = talloc_stackframe();
+ setup_logging("winbindd", DEBUG_DEFAULT_STDOUT);
+
/* glibc (?) likes to print "User defined signal 1" and exit if a
SIGUSR[12] is received before a handler is installed */
SAFE_FREE(lfile);
}
}
+
if (log_stdout) {
setup_logging("winbindd", DEBUG_STDOUT);
} else {