[jdev] patch for mu-conference. arguments for log_* functions

Ilja Booij ibooij at gmail.com
Thu Jan 6 09:06:56 CST 2005


Hi list, 

while trying to hunt down bugs that caused our mu-conference server to
fall over, I've found the following: quite some calls to the log
functions (log_debug, log_warn etc) have wrong arguments, or a wrong
number of arguments. I've found this by using gcc's __attribute__
macro.

patch is below

cheers,
Ilja

diff -Naur mu-conference-0.6.0.orig/src/admin.c mu-conference-0.6.0/src/admin.c
--- mu-conference-0.6.0.orig/src/admin.c	2003-11-15 05:19:44.000000000 +0100
+++ mu-conference-0.6.0/src/admin.c	2005-01-06 15:21:49.000000000 +0100
@@ -34,7 +34,7 @@
 
     if(result == NULL)
     {
-        log_warn(NAME, "[%s] Aborting: NULL result - <%s>", FZONE, key);
+        log_warn(NAME, "[%s] Aborting: NULL result - <%s>", FZONE,
(char*) key);
         return;
     }
 
@@ -42,7 +42,7 @@
 
     if(room == NULL)
     {
-        log_warn(NAME, "[%s] Aborting: NULL room - <%s>", FZONE, key);
+      log_warn(NAME, "[%s] Aborting: NULL room - <%s>", FZONE, (char*) key);
         return;
     }
 
@@ -78,7 +78,7 @@
 
     if(result == NULL || item == NULL)
     {
-        log_warn(NAME, "[%s] Aborting: NULL attribute(s) - <%s>", FZONE, key);
+        log_warn(NAME, "[%s] Aborting: NULL attribute(s) - <%s>",
FZONE, (char *) key);
         return;
     }
 
diff -Naur mu-conference-0.6.0.orig/src/conference.c
mu-conference-0.6.0/src/conference.c
--- mu-conference-0.6.0.orig/src/conference.c	2003-11-15
05:19:44.000000000 +0100
+++ mu-conference-0.6.0/src/conference.c	2005-01-06 15:49:38.000000000 +0100
@@ -31,7 +31,7 @@
 
     if(room == NULL)
     {
-        log_warn(NAME, "[%s] Aborting: NULL room %s", FZONE, key);
+        log_warn(NAME, "[%s] Aborting: NULL room %s", FZONE, (char *) key);
 	return;
     }
 
@@ -69,7 +69,7 @@
 
     if(room == NULL)
     {
-        log_warn(NAME, "[%s] Aborting: NULL room %s", FZONE, key);
+        log_warn(NAME, "[%s] Aborting: NULL room %s", FZONE, (char *) key);
 	return;
     }
 
@@ -862,7 +862,7 @@
 
     if(room == NULL)
     {
-        log_warn(NAME, "[%s] SHUTDOWN: Aborting attempt to clear %s",
FZONE, key);
+        log_warn(NAME, "[%s] SHUTDOWN: Aborting attempt to clear %s",
FZONE, (char *) key);
 	return;
     }
 
@@ -914,7 +914,7 @@
 
     if(user == NULL)
     {
-        log_warn(NAME, "[%s] Aborting : NULL cnu for %s", FZONE, key);
+        log_warn(NAME, "[%s] Aborting : NULL cnu for %s", FZONE, (char *) key);
 	return;
     }
 
@@ -934,11 +934,11 @@
     xmlnode node;
     char *user_name;
 
-    log_debug(NAME, "[%s] HBTICK: Idle check for >%s<", FZONE, key);
+    log_debug(NAME, "[%s] HBTICK: Idle check for >%s<", FZONE, (char*) key);
 
     if(room == NULL)
     {
-        log_warn(NAME, "[%s] Aborting : NULL cnr for %s", FZONE, key);
+        log_warn(NAME, "[%s] Aborting : NULL cnr for %s", FZONE, (char*) key);
 	return;
     }
     
@@ -961,7 +961,7 @@
     /* Destroy timed-out dynamic room */
     if(room->persistent == 0 && room->count == 0 && (now - room->last) > 240)
     {
-        log_debug(NAME, "[%s] HBTICK: Locking room and adding %s to
remove queue", FZONE, key, now);
+        log_debug(NAME, "[%s] HBTICK: Locking room and adding %s to
remove queue", FZONE, (char*) key);
         room->locked = 1;
         g_queue_push_tail(room->master->queue, g_strdup(jid_full(room->id)));
     }
@@ -974,7 +974,7 @@
 
     if(room == NULL)
     {
-        log_warn(NAME, "[%s] Aborting : NULL cnr for %s", FZONE, key);
+        log_warn(NAME, "[%s] Aborting : NULL cnr for %s", FZONE, (char*) key);
 	return;
     }
     
@@ -995,7 +995,7 @@
 
     if(room == NULL)
     {
-        log_warn(NAME, "[%s] Aborting : NULL cnr for %s", FZONE, key);
+        log_warn(NAME, "[%s] Aborting : NULL cnr for %s", FZONE, (char*) key);
 	return;
     }
     
diff -Naur mu-conference-0.6.0.orig/src/conference_room.c
mu-conference-0.6.0/src/conference_room.c
--- mu-conference-0.6.0.orig/src/conference_room.c	2003-11-15
05:19:45.000000000 +0100
+++ mu-conference-0.6.0/src/conference_room.c	2005-01-06
15:43:49.000000000 +0100
@@ -35,7 +35,7 @@
 
     if(message == NULL || room == NULL) 
     {
-	log_warn(NAME, "[%s] ERR: Aborting - NULL reference found -
[%s][%s]", FZONE, message, room);
+	log_warn(NAME, "[%s] ERR: Aborting - NULL reference found - ", FZONE);
 	return;
     }
 
@@ -562,7 +562,7 @@
 
     if(room == NULL) 
     {
-	log_warn(NAME, "[%s] Aborting - NULL attribute found -%s- -%s-", FZONE, room);
+	log_warn(NAME, "[%s] Aborting - NULL attribute found", FZONE);
 	return;
     }
 
diff -Naur mu-conference-0.6.0.orig/src/conference_user.c
mu-conference-0.6.0/src/conference_user.c
--- mu-conference-0.6.0.orig/src/conference_user.c	2003-11-15
05:19:45.000000000 +0100
+++ mu-conference-0.6.0/src/conference_user.c	2005-01-06
15:42:34.000000000 +0100
@@ -458,7 +458,7 @@
 
     if(user == NULL || data == NULL)
     {
-        log_warn(NAME, "Aborting: NULL attribute found", FZONE);
+        log_warn(NAME, "[%s]: Aborting: NULL attribute found", FZONE);
 
 	if(data != NULL)
             xmlnode_free(data);
diff -Naur mu-conference-0.6.0.orig/src/hash.c mu-conference-0.6.0/src/hash.c
--- mu-conference-0.6.0.orig/src/hash.c	2003-11-15 05:19:45.000000000 +0100
+++ mu-conference-0.6.0/src/hash.c	2005-01-06 15:06:11.000000000 +0100
@@ -22,7 +22,7 @@
 
 gboolean remove_key(gpointer key, gpointer data, gpointer arg)
 {
-   log_debug(NAME, "[%s] Auto-removing key %s", FZONE, key);
+   log_debug(NAME, "[%s] Auto-removing key %s", FZONE, (char*) key);
 
    free(key);
    free(data);
@@ -31,7 +31,7 @@
 
 void ght_remove_key(gpointer data)
 {
-   log_debug(NAME, "[%s] Auto-removing key %s", FZONE, data);
+   log_debug(NAME, "[%s] Auto-removing key %s", FZONE, (char*) data);
    free(data);
 }

diff -Naur mu-conference-0.6.0.orig/src/xdb.c mu-conference-0.6.0/src/xdb.c
--- mu-conference-0.6.0.orig/src/xdb.c	2003-11-15 05:19:46.000000000 +0100
+++ mu-conference-0.6.0/src/xdb.c	2005-01-06 15:07:18.000000000 +0100
@@ -462,13 +462,13 @@
 
 	if(item)
 	{
-            log_debug(NAME, "[%s] Found (%s) in rooms.xml -
removing", FZONE, jid_full(room->id), jid_full(jid_fix(store)));
+            log_debug(NAME, "[%s] Found (%s) in rooms.xml - removing,
%s", FZONE, jid_full(room->id), jid_full(jid_fix(store)));
 	    xmlnode_hide(item);
 	    xdb_set(master->xdbc, fulljid, "muc:room:list", node);
 	}
 	else
 	{
-            log_debug(NAME, "[%s] (%s) not found in rooms.xml -
ignoring", FZONE, jid_full(room->id), jid_full(jid_fix(store)));
+            log_debug(NAME, "[%s] (%s) not found in rooms.xml -
ignoring, %s", FZONE, jid_full(room->id), jid_full(jid_fix(store)));
 	}
     }



More information about the JDev mailing list