[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r14065: Fix a couple of bugs in setting control log callback severit (in tor/trunk: . src/common src/or)



Author: nickm
Date: 2008-03-16 23:37:52 -0400 (Sun, 16 Mar 2008)
New Revision: 14065

Modified:
   tor/trunk/
   tor/trunk/src/common/log.c
   tor/trunk/src/or/control.c
Log:
 r18861@catbus:  nickm | 2008-03-16 23:22:56 -0400
 Fix a couple of bugs in setting control log callback severity.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r18861] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/common/log.c
===================================================================
--- tor/trunk/src/common/log.c	2008-03-17 03:32:31 UTC (rev 14064)
+++ tor/trunk/src/common/log.c	2008-03-17 03:37:52 UTC (rev 14065)
@@ -571,10 +571,12 @@
                              log_callback cb)
 {
   logfile_t *lf;
+  log_severity_list_t severities;
+  set_log_severity_config(loglevelMin, loglevelMax, &severities);
   LOCK_LOGS();
   for (lf = logfiles; lf; lf = lf->next) {
     if (lf->callback == cb) {
-      set_log_severity_config(loglevelMin, loglevelMax, lf->severities);
+      memcpy(lf->severities, &severities, sizeof(severities));
     }
   }
   _log_global_min_severity = get_min_log_level();

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2008-03-17 03:32:31 UTC (rev 14064)
+++ tor/trunk/src/or/control.c	2008-03-17 03:37:52 UTC (rev 14065)
@@ -248,9 +248,13 @@
     if (max_log_event < EVENT_ERR_MSG)
       max_log_event = EVENT_ERR_MSG;
   }
-  change_callback_log_severity(event_to_log_severity(min_log_event),
-                               event_to_log_severity(max_log_event),
-                               control_event_logmsg);
+  if (min_log_event <= max_log_event)
+    change_callback_log_severity(event_to_log_severity(min_log_event),
+                                 event_to_log_severity(max_log_event),
+                                 control_event_logmsg);
+  else
+    change_callback_log_severity(LOG_ERR, LOG_ERR,
+                                 control_event_logmsg);
 }
 
 /** Return true iff the event with code <b>c</b> is being sent to any current