diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-07-28 21:27:00 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-07-28 21:27:00 +0400 |
commit | 922b62c8c3c59a287729726234b1b507da333a33 (patch) | |
tree | 5035ab823420a825e92b85a409860e58e1e04c77 /src/symbols_cache.c | |
parent | 1b106b62bc140af89e14cb91b10f7978a47932fc (diff) | |
download | rspamd-922b62c8c3c59a287729726234b1b507da333a33.tar.gz rspamd-922b62c8c3c59a287729726234b1b507da333a33.zip |
* Fix error with writing symbols cache file
* Fix error while working in utf mode when raw regexps was not created properly
Diffstat (limited to 'src/symbols_cache.c')
-rw-r--r-- | src/symbols_cache.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/symbols_cache.c b/src/symbols_cache.c index ee931458e..d615ba74b 100644 --- a/src/symbols_cache.c +++ b/src/symbols_cache.c @@ -139,7 +139,7 @@ unmap_cache_file (gpointer arg) static gboolean mmap_cache_file (struct symbols_cache *cache, int fd, memory_pool_t *pool) { - void *map; + guint8 *map; int i; GList *cur; struct cache_item *item; @@ -158,14 +158,14 @@ mmap_cache_file (struct symbols_cache *cache, int fd, memory_pool_t *pool) cur = g_list_first (cache->negative_items); while (cur) { item = cur->data; - item->s = ((struct saved_cache_item *)map) + i; + item->s = (struct saved_cache_item *)(map + i * sizeof (struct saved_cache_item)); cur = g_list_next (cur); i ++; } cur = g_list_first (cache->static_items); while (cur) { item = cur->data; - item->s = ((struct saved_cache_item *)map) + i; + item->s = (struct saved_cache_item *)(map + i * sizeof (struct saved_cache_item)); cur = g_list_next (cur); i ++; } @@ -201,7 +201,7 @@ create_cache_file (struct symbols_cache *cache, const char *filename, int fd, me cur = g_list_first (cache->negative_items); while (cur) { item = cur->data; - if (write (fd, &item->s, sizeof (struct saved_cache_item)) == -1) { + if (write (fd, item->s, sizeof (struct saved_cache_item)) == -1) { msg_err ("cannot write to file %d, %s", errno, strerror (errno)); close (fd); g_checksum_free (cksum); @@ -213,7 +213,7 @@ create_cache_file (struct symbols_cache *cache, const char *filename, int fd, me cur = g_list_first (cache->static_items); while (cur) { item = cur->data; - if (write (fd, &item->s, sizeof (struct saved_cache_item)) == -1) { + if (write (fd, item->s, sizeof (struct saved_cache_item)) == -1) { msg_err ("cannot write to file %d, %s", errno, strerror (errno)); close (fd); g_checksum_free (cksum); |