aboutsummaryrefslogtreecommitdiffstats
path: root/src/statfile.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-09-28 19:11:05 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-09-28 19:11:05 +0400
commitee3d2182e1ce2a65822ac5a7dc51201a7c8b327d (patch)
treef8d9de66f3d7bb77ce7e571bf210a40a91d67ea3 /src/statfile.c
parente1fea1e66d0f1111e934bb0e86bd2ce25da6df6e (diff)
downloadrspamd-ee3d2182e1ce2a65822ac5a7dc51201a7c8b327d.tar.gz
rspamd-ee3d2182e1ce2a65822ac5a7dc51201a7c8b327d.zip
* Fix race between learn and classify
Diffstat (limited to 'src/statfile.c')
-rw-r--r--src/statfile.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/statfile.c b/src/statfile.c
index d1382e368..20b415bf6 100644
--- a/src/statfile.c
+++ b/src/statfile.c
@@ -171,8 +171,7 @@ statfile_pool_open (statfile_pool_t *pool, char *filename)
}
- /* XXX: this is temporary copy of name to avoid strdup early */
- new_file->filename = filename;
+ g_strlcpy (new_file->filename, filename, sizeof (new_file->filename));
new_file->len = st.st_size;
if (statfile_pool_check (new_file) == -1) {
pool->opened --;
@@ -180,7 +179,6 @@ statfile_pool_open (statfile_pool_t *pool, char *filename)
}
pool->occupied += st.st_size;
- new_file->filename = memory_pool_strdup (pool->pool, filename);
new_file->open_time = time (NULL);
new_file->access_time = new_file->open_time;
new_file->lock = memory_pool_get_mutex (pool->pool);
@@ -400,7 +398,7 @@ stat_file_t *
statfile_pool_is_open (statfile_pool_t *pool, char *filename)
{
static stat_file_t f, *ret;
- f.filename = filename;
+ g_strlcpy (f.filename, filename, sizeof (f.filename));
ret = bsearch (&f, pool->files, pool->opened, sizeof (stat_file_t), cmpstatfile);
return ret;
}