static struct debug_class *dbgc_config = debug_class_list_initial;
static int current_msg_level = 0;
+static int current_msg_class = 0;
#if defined(WITH_SYSLOG) || defined(HAVE_LIBSYSTEMD_JOURNAL) || defined(HAVE_LIBSYSTEMD)
static int debug_level_to_priority(int level)
Fix from dgibson@linuxcare.com.
**************************************************************************/
+static bool reopen_one_log(int *fd, const char *logfile)
+{
+ int old_fd = *fd;
+ int new_fd;
+
+ new_fd = open(logfile, O_WRONLY|O_APPEND|O_CREAT, 0644);
+ if (new_fd == -1) {
+ log_overflow = true;
+ DBG_ERR("Unable to open new log file '%s': %s\n",
+ logfile, strerror(errno));
+ log_overflow = false;
+ return false;
+ }
+
+ debug_close_fd(old_fd);
+ smb_set_close_on_exec(new_fd);
+ *fd = new_fd;
+
+ return true;
+}
+
/**
reopen the log file (usually called because the log file name might have changed)
*/
{
mode_t oldumask;
int new_fd = 0;
- int old_fd = 0;
- bool ret = true;
+ bool ok;
if (state.reopening_logs) {
return true;
state.reopening_logs = true;
- new_fd = open( state.debugf, O_WRONLY|O_APPEND|O_CREAT, 0644);
-
- if (new_fd == -1) {
- log_overflow = true;
- DEBUG(0, ("Unable to open new log file '%s': %s\n", state.debugf, strerror(errno)));
- log_overflow = false;
- ret = false;
- } else {
- smb_set_close_on_exec(new_fd);
- old_fd = state.fd;
- state.fd = new_fd;
- debug_close_fd(old_fd);
- }
+ ok = reopen_one_log(&state.fd, state.debugf);
/* Fix from klausr@ITAP.Physik.Uni-Stuttgart.De
* to fix problem where smbd's that generate less
state.reopening_logs = false;
- return ret;
+ return ok;
}
/**************************************************************************
/* Set current_msg_level. */
current_msg_level = level;
+ /* Set current message class */
+ current_msg_class = cls;
+
/* Don't print a header if we're logging to stdout. */
if ( state.logtype != DEBUG_FILE ) {
return( true );