aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-06-05 16:39:59 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-06-05 16:39:59 +0400
commit3cd423a9d825d10c2e0390a2a35a5f99a1f74127 (patch)
tree692d75f333e2158b6427b2aa91be23702a49e5d3 /src
parent2be622266017d22e7f65d47bc4023d0135d3e29b (diff)
downloadrspamd-3cd423a9d825d10c2e0390a2a35a5f99a1f74127.tar.gz
rspamd-3cd423a9d825d10c2e0390a2a35a5f99a1f74127.zip
* Do not use values from clock_gettime for getting current time
Diffstat (limited to 'src')
-rw-r--r--src/plugins/surbl.c4
-rw-r--r--src/util.c6
-rw-r--r--src/util.h2
-rw-r--r--src/worker.c2
4 files changed, 8 insertions, 6 deletions
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 4ac156f99..87f0c5faf 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -658,10 +658,10 @@ surbl_test_url (struct worker_task *task)
/* Try to check lists */
if (surbl_module_ctx->tld2_file) {
- maybe_parse_host_list (surbl_module_ctx->surbl_pool, surbl_module_ctx->tld2, surbl_module_ctx->tld2_file, task->ts.tv_sec);
+ maybe_parse_host_list (surbl_module_ctx->surbl_pool, surbl_module_ctx->tld2, surbl_module_ctx->tld2_file);
}
if (surbl_module_ctx->whitelist_file) {
- maybe_parse_host_list (surbl_module_ctx->surbl_pool, surbl_module_ctx->whitelist, surbl_module_ctx->whitelist_file, task->ts.tv_sec);
+ maybe_parse_host_list (surbl_module_ctx->surbl_pool, surbl_module_ctx->whitelist, surbl_module_ctx->whitelist_file);
}
url_tree = g_tree_new ((GCompareFunc)g_ascii_strcasecmp);
diff --git a/src/util.c b/src/util.c
index 026cfbd23..cb2d948ec 100644
--- a/src/util.c
+++ b/src/util.c
@@ -936,22 +936,24 @@ parse_host_list (memory_pool_t *pool, GHashTable *tbl, const char *filename)
}
gboolean
-maybe_parse_host_list (memory_pool_t *pool, GHashTable *tbl, const char *filename, time_t tv)
+maybe_parse_host_list (memory_pool_t *pool, GHashTable *tbl, const char *filename)
{
struct list_file *lf;
struct stat cur_st;
+ time_t cur_time = time (NULL);
if (listfiles == NULL || (lf = g_hash_table_lookup (listfiles, filename)) == NULL) {
/* Do not try to parse unknown files */
return FALSE;
}
- if (tv - lf->st.st_mtime > MON_TIMEOUT) {
+ if (cur_time - lf->st.st_mtime > MON_TIMEOUT) {
/* Try to stat */
if (stat (lf->filename, &cur_st) != -1) {
if (cur_st.st_mtime > lf->st.st_mtime) {
g_hash_table_remove (listfiles, lf->filename);
g_hash_table_remove_all (tbl);
+ msg_info ("maybe_parse_host_list: file %s was modified and rereaded", filename);
return parse_host_list (pool, tbl, filename);
}
}
diff --git a/src/util.h b/src/util.h
index d771e74d8..c6ca2c25e 100644
--- a/src/util.h
+++ b/src/util.h
@@ -60,7 +60,7 @@ const char* calculate_check_time (struct timespec *begin, int resolution);
void set_counter (const char *name, long int value);
gboolean parse_host_list (memory_pool_t *pool, GHashTable *tbl, const char *filename);
-gboolean maybe_parse_host_list (memory_pool_t *pool, GHashTable *tbl, const char *filename, time_t tv);
+gboolean maybe_parse_host_list (memory_pool_t *pool, GHashTable *tbl, const char *filename);
#endif
diff --git a/src/worker.c b/src/worker.c
index af4575919..99c311e1f 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -254,7 +254,7 @@ accept_socket (int fd, short what, void *arg)
struct worker_task *new_task;
socklen_t addrlen = sizeof(ss);
int nfd;
-
+
if ((nfd = accept_from_socket (fd, (struct sockaddr *)&ss, &addrlen)) == -1) {
msg_warn ("accept_socket: accept failed: %s", strerror (errno));
return;