Bug in log.c

"Michael Mulcahy" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi All,

There is a bug in the logging functions debug, info, warning, error and
panic 
which cause a crash when called from a thread that has a thread id larger 
than 1024, i.e. gwthread_self returns value > 1024

In the log module there is an array for mapping threads to logfiles:

#define THREADTABLE_SIZE 1024
static unsigned int thread_to [ (long) THREADTABLE_SIZE ];

The log functions use this to identify which log file to write the data to, 
as in following:

void error(int e, const char *fmt, ...) 
{
    if ((e = thread_to[gwthread_self()])) {	/**** Relevent line ***/
        FUNCTION_GUTS_EXCL(GW_ERROR, "");
    } else {
        FUNCTION_GUTS(GW_ERROR, "");
    }
}

Unfortunately if gwthread_self returns a value greater than 1024 then
problems
occur.

Comments or suggestions appreciated!

Kindest Regards
Michael.
winmail.dat (application/ms-tnef, 1.9 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.