aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/binlog.c2
-rw-r--r--src/buffer.c2
-rw-r--r--src/cfg_utils.c2
-rw-r--r--src/html.c2
-rw-r--r--src/kvstorage.c4
-rw-r--r--src/kvstorage_bdb.c7
-rw-r--r--src/kvstorage_file.c2
-rw-r--r--src/url.c2
8 files changed, 14 insertions, 9 deletions
diff --git a/src/binlog.c b/src/binlog.c
index f87a81b00..47070b3af 100644
--- a/src/binlog.c
+++ b/src/binlog.c
@@ -483,7 +483,7 @@ binlog_sync (struct rspamd_binlog *log, guint64 from_rev, guint64 *from_time, GB
}
(*rep)->data = g_malloc (idx->len);
- if ((read (log->fd, (*rep)->data, idx->len)) != idx->len) {
+ if ((read (log->fd, (*rep)->data, idx->len)) != (ssize_t)idx->len) {
msg_warn ("cannot read file %s, error %d, %s", log->filename, errno, strerror (errno));
res = FALSE;
goto end;
diff --git a/src/buffer.c b/src/buffer.c
index 5c7cae197..d5bf673dd 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -224,7 +224,7 @@ write_buffers (gint fd, rspamd_io_dispatcher_t * d, gboolean is_delayed)
while (cur) {
buf = cur->data;
blen = BUFREMAIN (buf);
- if (r >= blen) {
+ if (r >= (ssize_t)blen) {
tmp = cur;
cur = g_list_previous (cur);
/* Mark this buffer as read */
diff --git a/src/cfg_utils.c b/src/cfg_utils.c
index f7d1b7ecf..f91882f98 100644
--- a/src/cfg_utils.c
+++ b/src/cfg_utils.c
@@ -294,7 +294,7 @@ parse_limit (const gchar *limit, guint len)
else if (*err_str == 'g' || *err_str == 'G') {
result *= 1073741824L;
}
- else if (len > 0 && err_str - limit != len) {
+ else if (len > 0 && err_str - limit != (gint)len) {
msg_warn ("invalid limit value '%s' at position '%s'", limit, err_str);
result = 0;
}
diff --git a/src/html.c b/src/html.c
index 04dfdfa89..dac09bf0e 100644
--- a/src/html.c
+++ b/src/html.c
@@ -578,7 +578,7 @@ decode_entitles (gchar *s, guint * len)
l = *len;
}
- while (h - s < l) {
+ while (h - s < (gint)l) {
switch (state) {
/* Out of entitle */
case 0:
diff --git a/src/kvstorage.c b/src/kvstorage.c
index f02f6a568..37d2022d9 100644
--- a/src/kvstorage.c
+++ b/src/kvstorage.c
@@ -403,7 +403,7 @@ rspamd_kv_storage_lookup (struct rspamd_kv_storage *storage, gpointer key, guint
if (elt && (elt->flags & KV_ELT_PERSISTENT) == 0 && elt->expire > 0) {
/* Check expiration */
- if (now - elt->age > elt->expire) {
+ if (now - elt->age > (gint)elt->expire) {
/* Set need expire as we have no write lock here */
elt->flags |= KV_ELT_NEED_EXPIRE;
elt = NULL;
@@ -639,7 +639,7 @@ rspamd_lru_expire_step (struct rspamd_kv_expire *e, struct rspamd_kv_storage *st
/* Check other elements in this queue */
TAILQ_FOREACH_SAFE (elt, &expire->head, entry, temp) {
if ((!forced &&
- (elt->flags & (KV_ELT_PERSISTENT|KV_ELT_DIRTY)) != 0) || elt->expire < (now - elt->age)) {
+ (elt->flags & (KV_ELT_PERSISTENT|KV_ELT_DIRTY)) != 0) || (gint)elt->expire < (now - elt->age)) {
break;
}
storage->memory -= ELT_SIZE (elt);
diff --git a/src/kvstorage_bdb.c b/src/kvstorage_bdb.c
index 99203285a..7970291f6 100644
--- a/src/kvstorage_bdb.c
+++ b/src/kvstorage_bdb.c
@@ -157,13 +157,18 @@ rspamd_bdb_init (struct rspamd_kv_backend *backend)
*/
db->envp->set_lk_detect (db->envp, DB_LOCK_DEFAULT);
+ /*
+ * Avoid explicit sync on committing
+ */
+ db->envp->set_flags (db->envp, DB_TXN_NOSYNC, 1);
+
flags = DB_CREATE | DB_THREAD;
/* Create and open db pointer */
if ((ret = db_create (&db->dbp, db->envp, 0)) != 0) {
goto err;
}
- if ((ret = db->dbp->open (db->dbp, NULL, db->filename, NULL, DB_BTREE, flags, 0)) != 0) {
+ if ((ret = db->dbp->open (db->dbp, NULL, db->filename, NULL, DB_HASH, flags, 0)) != 0) {
goto err;
}
diff --git a/src/kvstorage_file.c b/src/kvstorage_file.c
index de06f778b..2857e680b 100644
--- a/src/kvstorage_file.c
+++ b/src/kvstorage_file.c
@@ -89,7 +89,7 @@ get_file_name (struct rspamd_file_backend *db, gchar *key, guint keylen, gchar *
}
/* Now we have directory, append base64 encoded filename */
k = key;
- if (end - p < keylen * 2 + 1) {
+ if (end - p < (gint)keylen * 2 + 1) {
/* Filebuf is not large enough */
return FALSE;
}
diff --git a/src/url.c b/src/url.c
index ade68ea1c..4936d9353 100644
--- a/src/url.c
+++ b/src/url.c
@@ -818,7 +818,7 @@ parse_uri (struct uri *uri, gchar *uristring, memory_pool_t * pool)
return URI_ERRNO_NO_PORT_COLON;
/* We only use 8 bits for portlen so better check */
- if (uri->portlen != port_end - host_end)
+ if ((gint)uri->portlen != port_end - host_end)
return URI_ERRNO_INVALID_PORT;
/* test if port is number */