The logsys_config_priority_set() API call only changes the priority of
the "MAIN" subsystem, not the one it was called from!

This patch fixes that while retaining API (though not ABI) compatibility.
-- 

Chrissie
Index: exec/logsys.c
===================================================================
--- exec/logsys.c	(revision 1519)
+++ exec/logsys.c	(working copy)
@@ -456,16 +456,16 @@
 	pthread_mutex_unlock (&logsys_new_log_mutex);
 }
 
-void logsys_config_priority_set (unsigned int priority)
+void _logsys_config_priority_set (unsigned int id, unsigned int priority)
 {
-	unsigned int tags;
-	unsigned int dummy_priority;
-
 	pthread_mutex_lock (&logsys_new_log_mutex);
 
-	logsys_config_subsys_get ("MAIN", &tags, &dummy_priority);
-	logsys_config_subsys_set ("MAIN", tags, priority);
+	logsys_loggers[id].priority = priority;
 
+	if (priority > logsys_loggers[id].priority) {
+		logsys_loggers[id].priority = priority;
+	}
+
 	pthread_mutex_unlock (&logsys_new_log_mutex);
 }
 
Index: exec/logsys.h
===================================================================
--- exec/logsys.h	(revision 1519)
+++ exec/logsys.h	(working copy)
@@ -108,9 +108,6 @@
 	char *name,
 	unsigned int facility);
 
-extern void logsys_config_priority_set (
-	unsigned int priority);
-
 extern unsigned int logsys_config_subsys_set (
 	const char *subsys,
 	unsigned int tags,
@@ -283,4 +280,10 @@
 	}								\
 } while(0)
 
+extern void _logsys_config_priority_set (unsigned int id, unsigned int priority);
+
+#define logsys_config_priority_set(priority) do {		        \
+	_logsys_config_priority_set (logsys_subsys_id, priority);       \
+} while(0)
+
 #endif /* LOGSYS_H_DEFINED */
Index: test/logsys_t2.c
===================================================================
--- test/logsys_t2.c	(revision 1519)
+++ test/logsys_t2.c	(working copy)
@@ -53,18 +53,18 @@
 	log_printf(LOG_NOTICE, "Hello, world!\n");
 	log_printf(LOG_DEBUG, "If you see this, the logger's busted\n");
 
-	logsys_config_priority_set (LOG_ALERT);
+	logsys_config_priority_set(LOG_ALERT);
 
 	log_printf(LOG_DEBUG, "If you see this, the logger's busted\n");
 	log_printf(LOG_CRIT, "If you see this, the logger's busted\n");
 	log_printf(LOG_ALERT, "Alert 1\n");
 
-	logsys_config_priority_set (LOG_NOTICE);
+	logsys_config_priority_set(LOG_NOTICE);
 
 	log_printf(LOG_CRIT, "Crit 1\n");
 	log_printf(LOG_INFO, "If you see this, the logger's busted\n");
 
-	logsys_config_priority_set (LOG_DEBUG);
+	logsys_config_priority_set(LOG_DEBUG);
 
 	log_printf(LOG_DEBUG, "Debug 1\n");
 
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to