diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-09-25 07:38:03 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-09-25 07:38:03 +0000 |
commit | 96d9bdcc09322528b02e471587bf2d4a4ee029d7 (patch) | |
tree | c81a1dac9e820b491fd335f2d7f4c851156dc046 | |
parent | 11b3854192211aefb419544d21d83e375b2a9fc1 (diff) | |
download | rsyslog-96d9bdcc09322528b02e471587bf2d4a4ee029d7.tar.gz rsyslog-96d9bdcc09322528b02e471587bf2d4a4ee029d7.tar.xz rsyslog-96d9bdcc09322528b02e471587bf2d4a4ee029d7.zip |
more cleanup on thread-safe CRL functions
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | syslogd.c | 13 |
2 files changed, 17 insertions, 1 deletions
@@ -4,6 +4,11 @@ Version 1.19.7 (rgerhards), 2007-09-1? a NUL character. It is now simply removed. This also caused trailing LF reduction to fail, when it was followed by such a NUL. This is now also handled. +- replaced some non-thread-safe function calls by their thread-safe + counterparts +- fixed a minor memory leak that occured when the %APPNAME% property was + used (I think nobody used that in practice) +- general code cleanup (e.g. compiler warnings, comments) --------------------------------------------------------------------------- Version 1.19.6 (rgerhards), 2007-09-11 - applied patch by varmojfekoj to change signal handling to the new @@ -1593,11 +1593,12 @@ void getCurrTime(struct syslogTime *t) { struct timeval tp; struct tm *tm; + struct tm tmBuf; long lBias; assert(t != NULL); gettimeofday(&tp, NULL); - tm = localtime((time_t*) &(tp.tv_sec)); + tm = localtime_r((time_t*) &(tp.tv_sec), &tmBuf); t->year = tm->tm_year + 1900; t->month = tm->tm_mon + 1; @@ -3845,6 +3846,11 @@ finalize_it: * loader for plug-ins. * rgerhards, 2007-07-21 * varmojfekoj added support for dynamically loadable modules on 2007-08-13 + * rgerhards, 2007-09-25: please note that the non-threadsafe function dlerror() is + * called below. This is ok because modules are currently only loaded during + * configuration file processing, which is executed on a single thread. Should we + * change that design at any stage (what is unlikely), we need to find a + * replacement. */ static rsRetVal doModLoad(uchar **pp, __attribute__((unused)) void* pVal) { @@ -4322,6 +4328,8 @@ static void init(void) if(!strcmp(LogPort, "0")) { /* we shall use the default syslog/udp port, so let's * look it up. + * NOTE: getservbyname() is not thread-safe, but this is OK as + * it is called only during init, in single-threading mode. */ sp = getservbyname("syslog", "udp"); if (sp == NULL) { @@ -6295,6 +6303,9 @@ int main(int argc, char **argv) * doesn't have LocalHostName listed, gethostbyname will * return NULL. */ + /* TODO: gethostbyname() is not thread-safe, but replacing it is + * not urgent as we do not run on multiple threads here. rgerhards, 2007-09-25 + */ hent = gethostbyname(LocalHostName); if(hent) { snprintf(LocalHostName, sizeof(LocalHostName), "%s", hent->h_name); |